From e1b4f9aafe6370e48262b6e0eacf629210b709c1 Mon Sep 17 00:00:00 2001 From: Diego Fabricio Date: Wed, 7 Aug 2024 02:22:08 -0500 Subject: [PATCH] feat(lorem-ipsum): add button to refresh text lorem-ipsum (#1213) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Diego Guzmán --- .../lorem-ipsum-generator/lorem-ipsum-generator.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tools/lorem-ipsum-generator/lorem-ipsum-generator.vue b/src/tools/lorem-ipsum-generator/lorem-ipsum-generator.vue index 9085725f9..ccd8b519a 100644 --- a/src/tools/lorem-ipsum-generator/lorem-ipsum-generator.vue +++ b/src/tools/lorem-ipsum-generator/lorem-ipsum-generator.vue @@ -2,6 +2,7 @@ import { generateLoremIpsum } from './lorem-ipsum-generator.service'; import { useCopy } from '@/composable/copy'; import { randIntFromInterval } from '@/utils/random'; +import { computedRefreshable } from '@/composable/computedRefreshable'; const paragraphs = ref(1); const sentences = ref([3, 8]); @@ -9,7 +10,7 @@ const words = ref([8, 15]); const startWithLoremIpsum = ref(true); const asHTML = ref(false); -const loremIpsumText = computed(() => +const [loremIpsumText, refreshLoremIpsum] = computedRefreshable(() => generateLoremIpsum({ paragraphCount: paragraphs.value, asHTML: asHTML.value, @@ -18,6 +19,7 @@ const loremIpsumText = computed(() => startWithLoremIpsum: startWithLoremIpsum.value, }), ); + const { copy } = useCopy({ source: loremIpsumText, text: 'Lorem ipsum copied to the clipboard' }); @@ -41,10 +43,13 @@ const { copy } = useCopy({ source: loremIpsumText, text: 'Lorem ipsum copied to -
+
Copy + + Refresh +