-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added Breadcrumb component * feat: breadcrumb improved --------- Co-authored-by: Anwarul Islam <[email protected]>
- Loading branch information
1 parent
25144be
commit a996760
Showing
3 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template> | ||
<nav> | ||
<ul | ||
class="flex items-center overflow-x-auto whitespace-nowrap px-4 py-2 text-tiny" | ||
> | ||
<li | ||
v-for="(item, index) in items" | ||
:key="index" | ||
:class="{ 'last-item': index === items.length - 1 }" | ||
class="flex items-center" | ||
@click="emit('select', { item, index })" | ||
> | ||
<span v-if="index < items.length - 1"> | ||
{{ item }} | ||
</span> | ||
|
||
<span v-else> | ||
{{ item }} | ||
</span> | ||
|
||
<span v-if="index < items.length - 1" class="mx-2"> | ||
<IconChevronRight /> | ||
</span> | ||
</li> | ||
</ul> | ||
</nav> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import IconChevronRight from "~icons/lucide/chevron-right" | ||
defineProps<{ | ||
items: string[] | ||
}>() | ||
const emit = defineEmits<{ | ||
( | ||
e: "select", | ||
value: { | ||
item: string | ||
index: number | ||
}, | ||
): void | ||
}>() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<template> | ||
<Story title="Breadcrumb"> | ||
<Variant title="Single"> | ||
<HoppBreadcrumb | ||
:items="['Home', 'Library', 'Data']" | ||
@select="onBreadcrumbSelect" | ||
/> | ||
</Variant> | ||
</Story> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { HoppBreadcrumb } from "../components" | ||
const onBreadcrumbSelect = (value: { item: string; index: number }) => { | ||
alert(`Selected: ${value.item} at index: ${value.index}`) | ||
} | ||
</script> |