Skip to content

Commit e1b4f9a

Browse files
difagumeDiego Guzmán
andauthored
feat(lorem-ipsum): add button to refresh text lorem-ipsum (CorentinTh#1213)
Co-authored-by: Diego Guzmán <[email protected]>
1 parent 76a19d2 commit e1b4f9a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/tools/lorem-ipsum-generator/lorem-ipsum-generator.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
import { generateLoremIpsum } from './lorem-ipsum-generator.service';
33
import { useCopy } from '@/composable/copy';
44
import { randIntFromInterval } from '@/utils/random';
5+
import { computedRefreshable } from '@/composable/computedRefreshable';
56
67
const paragraphs = ref(1);
78
const sentences = ref([3, 8]);
89
const words = ref([8, 15]);
910
const startWithLoremIpsum = ref(true);
1011
const asHTML = ref(false);
1112
12-
const loremIpsumText = computed(() =>
13+
const [loremIpsumText, refreshLoremIpsum] = computedRefreshable(() =>
1314
generateLoremIpsum({
1415
paragraphCount: paragraphs.value,
1516
asHTML: asHTML.value,
@@ -18,6 +19,7 @@ const loremIpsumText = computed(() =>
1819
startWithLoremIpsum: startWithLoremIpsum.value,
1920
}),
2021
);
22+
2123
const { copy } = useCopy({ source: loremIpsumText, text: 'Lorem ipsum copied to the clipboard' });
2224
</script>
2325

@@ -41,10 +43,13 @@ const { copy } = useCopy({ source: loremIpsumText, text: 'Lorem ipsum copied to
4143

4244
<c-input-text :value="loremIpsumText" multiline placeholder="Your lorem ipsum..." readonly mt-5 rows="5" />
4345

44-
<div mt-5 flex justify-center>
46+
<div mt-5 flex justify-center gap-3>
4547
<c-button autofocus @click="copy()">
4648
Copy
4749
</c-button>
50+
<c-button @click="refreshLoremIpsum">
51+
Refresh
52+
</c-button>
4853
</div>
4954
</c-card>
5055
</template>

0 commit comments

Comments
 (0)