-
Notifications
You must be signed in to change notification settings - Fork 622
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Accordion): new component (#301)
Co-authored-by: Benjamin Canac <[email protected]>
- Loading branch information
1 parent
0bfe4b0
commit e50f377
Showing
12 changed files
with
541 additions
and
6 deletions.
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
33 changes: 33 additions & 0 deletions
33
docs/components/content/examples/AccordionExampleBasic.vue
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,33 @@ | ||
<script setup> | ||
const items = [{ | ||
label: 'Getting Started', | ||
icon: 'i-heroicons-information-circle', | ||
defaultOpen: true, | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Installation', | ||
icon: 'i-heroicons-arrow-down-tray', | ||
disabled: true, | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Theming', | ||
icon: 'i-heroicons-eye-dropper', | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Layouts', | ||
icon: 'i-heroicons-rectangle-group', | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Components', | ||
icon: 'i-heroicons-square-3-stack-3d', | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Utilities', | ||
icon: 'i-heroicons-wrench-screwdriver', | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}] | ||
</script> | ||
|
||
<template> | ||
<UAccordion :items="items" /> | ||
</template> |
52 changes: 52 additions & 0 deletions
52
docs/components/content/examples/AccordionExampleDefaultSlot.vue
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,52 @@ | ||
<script setup> | ||
const items = [{ | ||
label: 'Getting Started', | ||
icon: 'i-heroicons-information-circle', | ||
defaultOpen: true, | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Installation', | ||
icon: 'i-heroicons-arrow-down-tray', | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Theming', | ||
icon: 'i-heroicons-eye-dropper', | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Layouts', | ||
icon: 'i-heroicons-rectangle-group', | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Components', | ||
icon: 'i-heroicons-square-3-stack-3d', | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Utilities', | ||
icon: 'i-heroicons-wrench-screwdriver', | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}] | ||
</script> | ||
|
||
<template> | ||
<UAccordion :items="items" :ui="{ wrapper: 'flex flex-col w-full' }"> | ||
<template #default="{ item, index, open }"> | ||
<UButton color="gray" variant="ghost" class="border-b border-gray-200 dark:border-gray-700" :ui="{ rounded :'rounded-none', padding: { sm:'p-3' } }"> | ||
<template #leading> | ||
<div class="w-6 h-6 rounded-full bg-primary-500 dark:bg-primary-400 flex items-center justify-center -my-1"> | ||
<UIcon :name="item.icon" class="w-4 h-4 text-white dark:text-gray-900" /> | ||
</div> | ||
</template> | ||
|
||
<span class="truncate">{{ index + 1 }}. {{ item.label }}</span> | ||
|
||
<template #trailing> | ||
<UIcon | ||
name="i-heroicons-chevron-right-20-solid" | ||
class="w-5 h-5 ms-auto transform transition-transform duration-200" | ||
:class="[open && 'rotate-90']" | ||
/> | ||
</template> | ||
</UButton> | ||
</template> | ||
</UAccordion> | ||
</template> |
74 changes: 74 additions & 0 deletions
74
docs/components/content/examples/AccordionExampleItemSlot.vue
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,74 @@ | ||
<script setup> | ||
const items = [{ | ||
label: 'Getting Started', | ||
icon: 'i-heroicons-information-circle', | ||
defaultOpen: true, | ||
slot: 'getting-started' | ||
}, { | ||
label: 'Installation', | ||
icon: 'i-heroicons-arrow-down-tray', | ||
defaultOpen: true, | ||
slot: 'installation' | ||
}, { | ||
label: 'Theming', | ||
icon: 'i-heroicons-eye-dropper', | ||
defaultOpen: true, | ||
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Layouts', | ||
icon: 'i-heroicons-rectangle-group', | ||
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Components', | ||
icon: 'i-heroicons-square-3-stack-3d', | ||
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}, { | ||
label: 'Utilities', | ||
icon: 'i-heroicons-wrench-screwdriver', | ||
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.' | ||
}] | ||
</script> | ||
|
||
<template> | ||
<UAccordion :items="items"> | ||
<template #item="{ item }"> | ||
<p class="italic text-gray-900 dark:text-white text-center"> | ||
{{ item.description }} | ||
</p> | ||
</template> | ||
|
||
<template #getting-started> | ||
<div class="flex flex-col justify-center items-center gap-1"> | ||
<NuxtLink to="/getting-started" class="flex items-end gap-1.5 font-bold text-xl text-gray-900 dark:text-white"> | ||
<Logo class="w-8 h-8 text-primary-500 dark:text-primary-400" /> | ||
|
||
<span class="hidden sm:block">NuxtLabs</span><span class="sm:text-primary-500 dark:sm:text-primary-400">UI</span> | ||
</NuxtLink> | ||
|
||
<p class="text-sm text-gray-500 dark:text-gray-400"> | ||
Fully styled and customizable components for Nuxt. | ||
</p> | ||
</div> | ||
</template> | ||
|
||
<template #installation="{ description }"> | ||
<div class="flex flex-col justify-center items-center gap-1 mb-4"> | ||
<h3 class="text-xl font-bold text-gray-900 dark:text-white"> | ||
Installation | ||
</h3> | ||
<p class="text-sm text-gray-500 dark:text-gray-400"> | ||
Install <code>@nuxthq/ui</code> dependency to your project: | ||
</p> | ||
<p> | ||
{{ description }} | ||
</p> | ||
</div> | ||
|
||
<div class="flex flex-col items-center"> | ||
<code>$ npm install @nuxtlabs/ui</code> | ||
<code>$ nnpm install -D @nuxthq/ui</code> | ||
<code>$ pnpm i -D @nuxthq/ui</code> | ||
</div> | ||
</template> | ||
</UAccordion> | ||
</template> |
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
Oops, something went wrong.
e50f377
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ui – ./
ui.nuxtlabs.com
ui-git-dev-nuxtlabs.vercel.app
ui-nuxtlabs.vercel.app