Skip to content

Commit

Permalink
feat(components): add icon prop to readmore (#38)
Browse files Browse the repository at this point in the history
Signed-off-by: ZTL-UwU <[email protected]>
  • Loading branch information
ZTL-UwU committed Oct 14, 2024
1 parent f7b8f2b commit 6a5bf03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 7 additions & 6 deletions components/content/ReadMore.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<template>
<Alert :to="to" :target="target" icon="lucide:bookmark">
<Alert :to="to" :target="target" :icon>
Read more at <span class="font-semibold">{{ computedTitle }}</span>
</Alert>
</template>

<script setup lang="ts">
const props = defineProps<{
const { title, to, icon = 'lucide:bookmark' } = defineProps<{
title?: string;
to: string;
target?: string;
icon?: string;
}>();
const computedTitle = computed<string>(
() => {
if (props.title)
return props.title;
if (title)
return title;
try {
return useBreadcrumb(props.to).map(x => x.title).join(' > ');
return useBreadcrumb(to).map(x => x.title).join(' > ');
} catch {
return props.to;
return to;
}
},
);
Expand Down
2 changes: 2 additions & 0 deletions content/1.getting-started/3.writing/2.components.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ The **Badges** under each component title marks compatibility with other doc tem
:read-more{to="/getting-started/writing/markdown"}
:read-more{title="Nuxt website" to="https://nuxt.com/"}
:read-more{to="https://nuxt.com/"}
:read-more{icon="lucide:link" to="https://nuxt.com/"}
::

```mdc [Code]
:read-more{to="/getting-started/writing/markdown"}
:read-more{title="Nuxt website" to="https://nuxt.com/"}
:read-more{to="https://nuxt.com/"}
:read-more{icon="lucide:link" to="https://nuxt.com/"}
```
::

Expand Down

0 comments on commit 6a5bf03

Please sign in to comment.