refactor: refactored classes logic
This commit is contained in:
@@ -51,7 +51,7 @@ function getComponents() {
|
||||
{ text: 'Modal', link: 'components/modal/modal.md' },
|
||||
{ text: 'Navbar', link: 'components/navbar/navbar.md' },
|
||||
|
||||
{ text: '- Accordion', link: 'components/accordion/accordion.md' },
|
||||
{ text: 'Accordion', link: 'components/accordion/accordion.md' },
|
||||
{ text: '- Carousel', link: 'components/carousel/carousel.md' },
|
||||
{ text: '- Footer', link: 'components/footer/footer.md' },
|
||||
{ text: '- Pagination', link: 'components/pagination/pagination.md' },
|
||||
|
||||
@@ -18,52 +18,40 @@ Use this example to basic accordion.
|
||||
```vue
|
||||
<script setup>
|
||||
import { Accordion } from 'flowbite'
|
||||
import AccordionPanel from '@/components/Accordion/AccordionPanel.vue'
|
||||
import AccordionHeader from '@/components/Accordion/AccordionHeader.vue'
|
||||
import AccordionContent from '@/components/Accordion/AccordionContent.vue'
|
||||
import AccordionPanel from 'flowbite'
|
||||
import AccordionHeader from 'flowbite'
|
||||
import AccordionContent from 'flowbite'
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>another header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>another header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
</Accordion>
|
||||
</template>
|
||||
@@ -77,52 +65,40 @@ Always open prop to makes accordion able to open multiple elements.
|
||||
```vue
|
||||
<script setup>
|
||||
import { Accordion } from 'flowbite'
|
||||
import AccordionPanel from '@/components/Accordion/AccordionPanel.vue'
|
||||
import AccordionHeader from '@/components/Accordion/AccordionHeader.vue'
|
||||
import AccordionContent from '@/components/Accordion/AccordionContent.vue'
|
||||
import AccordionPanel from 'flowbite'
|
||||
import AccordionHeader from 'flowbite'
|
||||
import AccordionContent from 'flowbite'
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion>
|
||||
<Accordion always-open>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>another header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>another header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
</Accordion>
|
||||
</template>
|
||||
@@ -136,52 +112,40 @@ Flush prop removes side borders, and rounded corners
|
||||
```vue
|
||||
<script setup>
|
||||
import { Accordion } from 'flowbite'
|
||||
import AccordionPanel from '@/components/Accordion/AccordionPanel.vue'
|
||||
import AccordionHeader from '@/components/Accordion/AccordionHeader.vue'
|
||||
import AccordionContent from '@/components/Accordion/AccordionContent.vue'
|
||||
import AccordionPanel from 'flowbite'
|
||||
import AccordionHeader from 'flowbite'
|
||||
import AccordionContent from 'flowbite'
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion flush>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>another header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>another header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
</Accordion>
|
||||
</template>
|
||||
@@ -195,52 +159,40 @@ You can style accordion content and headers by passing tailwind classes into the
|
||||
```vue
|
||||
<script setup>
|
||||
import { Accordion } from 'flowbite'
|
||||
import AccordionPanel from '@/components/Accordion/AccordionPanel.vue'
|
||||
import AccordionHeader from '@/components/Accordion/AccordionHeader.vue'
|
||||
import AccordionContent from '@/components/Accordion/AccordionContent.vue'
|
||||
import AccordionPanel from 'flowbite'
|
||||
import AccordionHeader from 'flowbite'
|
||||
import AccordionContent from 'flowbite'
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion flush>
|
||||
<Accordion >
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header class="bg-blue-800">another header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header class="bg-pink-200 dark:bg-pink-900 dark:text-gray-50">another header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
</Accordion>
|
||||
</template>
|
||||
|
||||
@@ -9,43 +9,31 @@ import AccordionContent from '@/components/Accordion/AccordionContent.vue'
|
||||
<template>
|
||||
<Accordion always-open>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>another header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>another header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
</Accordion>
|
||||
</template>
|
||||
|
||||
@@ -9,43 +9,31 @@ import AccordionContent from '@/components/Accordion/AccordionContent.vue'
|
||||
<template>
|
||||
<Accordion>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>another header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>another header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
</Accordion>
|
||||
</template>
|
||||
|
||||
@@ -9,43 +9,31 @@ import AccordionContent from '@/components/Accordion/AccordionContent.vue'
|
||||
<template>
|
||||
<Accordion flush>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>another header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>another header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
</Accordion>
|
||||
</template>
|
||||
|
||||
@@ -7,45 +7,33 @@ import AccordionContent from '@/components/Accordion/AccordionContent.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion flush>
|
||||
<Accordion >
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out this guide to learn how to <a href="/docs/getting-started/introduction/" class="text-blue-600 dark:text-blue-500 hover:underline">get started</a> and start developing websites even faster with components on top of Tailwind CSS.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header class="bg-blue-800">another header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header class="bg-pink-200 dark:bg-pink-900 dark:text-gray-50">another header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
<accordion-panel>
|
||||
<template #header>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
</template>
|
||||
<template #content>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</template>
|
||||
<accordion-header>and one more header</accordion-header>
|
||||
<accordion-content>
|
||||
<div>
|
||||
<p class="mb-2 text-gray-500 dark:text-gray-400">Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.</p>
|
||||
<p class="text-gray-500 dark:text-gray-400">Check out the <a href="https://flowbite.com/figma/" class="text-blue-600 dark:text-blue-500 hover:underline">Figma design system</a> based on the utility classes from Tailwind CSS and components from Flowbite.</p>
|
||||
</div>
|
||||
</accordion-content>
|
||||
</accordion-panel>
|
||||
</Accordion>
|
||||
</template>
|
||||
|
||||
@@ -1,28 +1,13 @@
|
||||
<template>
|
||||
<div
|
||||
:class="{
|
||||
hidden: !panelState.isVisible,
|
||||
'border-b-0': panelState.order !== panelsCount - 1 || accordionState.flush,
|
||||
'border-t-0': panelState.order === panelsCount - 1,
|
||||
'border-x-0': accordionState.flush,
|
||||
}"
|
||||
class="p-5 border border-gray-200 dark:border-gray-700 dark:bg-gray-900"
|
||||
:class="contentClasses"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useAccordionState } from '@/components/Accordion/composables/useAccordionState'
|
||||
import { computed, inject } from 'vue'
|
||||
import { useAccordionContentClasses } from '@/components/Accordion/composables/useAccordionContentClasses'
|
||||
|
||||
const accordionId: any = inject('accordionId')
|
||||
const panelId: any = inject('panelId')
|
||||
|
||||
|
||||
const { accordionsStates } = useAccordionState()
|
||||
|
||||
const accordionState = computed(() => accordionsStates[accordionId])
|
||||
const panelState = computed(() => accordionsStates[accordionId].panels[panelId])
|
||||
const panelsCount = computed(() => Object.keys(accordionsStates[accordionId].panels[panelId]).length)
|
||||
const { contentClasses } = useAccordionContentClasses()
|
||||
</script>
|
||||
|
||||
@@ -2,19 +2,12 @@
|
||||
<button
|
||||
type="button"
|
||||
@click="toggleItem"
|
||||
:class="{
|
||||
'rounded-t-xl': panelState.order === 0 && !accordionState.flush,
|
||||
'border-t-0': panelState.order === 0 && accordionState.flush,
|
||||
'border-b-0': isBottomBorderVisibleForFlush,
|
||||
'border-x-0': accordionState.flush,
|
||||
}"
|
||||
class="flex items-center p-5 w-full font-medium text-left text-gray-500 border border-gray-200 focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 dark:border-gray-700 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"
|
||||
:class="headerClasses"
|
||||
>
|
||||
<span class="w-full"><slot /></span>
|
||||
<svg
|
||||
data-accordion-icon
|
||||
class="w-6 h-6 shrink-0"
|
||||
:class="{'rotate-180': panelState.isVisible}"
|
||||
:class="arrowClasses"
|
||||
fill="currentColor"
|
||||
viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
@@ -27,36 +20,30 @@
|
||||
<script lang="ts" setup>
|
||||
import { useAccordionState } from '@/components/Accordion/composables/useAccordionState'
|
||||
import { computed, inject } from 'vue'
|
||||
import { useAccordionHeaderClasses } from '@/components/Accordion/composables/useAccordionHeaderClasses'
|
||||
|
||||
const accordionId: string = inject('accordionId') ?? ''
|
||||
const panelId: string = inject('panelId') ?? ''
|
||||
|
||||
const accordionId: any = inject('accordionId')
|
||||
const panelId: any = inject('panelId')
|
||||
|
||||
const { accordionsStates } = useAccordionState()
|
||||
const accordionState = computed(() => accordionsStates[accordionId])
|
||||
const panelsCount = computed(() => Object.keys(accordionsStates[accordionId].panels[panelId]).length)
|
||||
const isPanelLast = computed(() => panelState.value.order !== panelsCount.value - 1)
|
||||
const isBottomBorderVisibleForFlush = computed(() =>
|
||||
isPanelLast.value ||
|
||||
(accordionState.value.flush && panelState.value.order === panelsCount.value - 1 && !panelState.value.isVisible))
|
||||
const panelState = computed(() => accordionState.value.panels[panelId])
|
||||
|
||||
const commonToggleItem = () => {
|
||||
const selectedPanel = accordionState.value.panels[panelId]
|
||||
const isSelectedVisible = selectedPanel.isVisible
|
||||
const { headerClasses, arrowClasses } = useAccordionHeaderClasses()
|
||||
function commonToggleItem() {
|
||||
const isSelectedVisible = panelState.value.isVisible
|
||||
for (const panelIndex in accordionState.value.panels) {
|
||||
const panel = accordionState.value.panels[panelIndex]
|
||||
if (panel.id !== panelId) panel.isVisible = false
|
||||
else panel.isVisible = !isSelectedVisible
|
||||
}
|
||||
}
|
||||
const alwaysOpenToggleItem = () => {
|
||||
const selectedPanel = accordionState.value.panels[panelId]
|
||||
selectedPanel.isVisible = !selectedPanel.isVisible
|
||||
function alwaysOpenToggleItem() {
|
||||
panelState.value.isVisible = !panelState.value.isVisible
|
||||
}
|
||||
const toggleItem = () => {
|
||||
function toggleItem() {
|
||||
if (accordionState.value.alwaysOpen ) return alwaysOpenToggleItem()
|
||||
commonToggleItem()
|
||||
}
|
||||
|
||||
const { accordionsStates } = useAccordionState()
|
||||
const panelState = computed(() => accordionsStates[accordionId].panels[panelId])
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// TODO: 1 слот
|
||||
<template>
|
||||
<div>
|
||||
<slot name="header"/>
|
||||
<slot name="content"/>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -13,7 +13,7 @@ import { nanoid } from 'nanoid'
|
||||
const { accordionsStates } = useAccordionState()
|
||||
|
||||
const panelId = nanoid()
|
||||
const accordionId: any = inject('accordionId')
|
||||
const accordionId: string = inject('accordionId') ?? ''
|
||||
provide('panelId', panelId)
|
||||
|
||||
const accordionState = computed(() => {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { computed, inject } from 'vue'
|
||||
import { useAccordionState } from '@/components/Accordion/composables/useAccordionState'
|
||||
import classNames from 'classnames'
|
||||
|
||||
|
||||
const baseContentClasses = 'p-5 border border-gray-200 dark:border-gray-700 dark:bg-gray-900'
|
||||
export function useAccordionContentClasses() {
|
||||
const accordionId: string = inject('accordionId') ?? ''
|
||||
const panelId: string = inject('panelId') ?? ''
|
||||
|
||||
|
||||
const { accordionsStates } = useAccordionState()
|
||||
|
||||
const accordionState = computed(() => accordionsStates[accordionId])
|
||||
const panelState = computed(() => accordionsStates[accordionId].panels[panelId])
|
||||
const panelsCount = computed(() => Object.keys(accordionsStates[accordionId].panels[panelId]).length)
|
||||
|
||||
const contentClasses = computed(() => classNames(baseContentClasses, {
|
||||
hidden: !panelState.value.isVisible,
|
||||
'border-b-0': panelState.value.order !== panelsCount.value - 1 || accordionState.value.flush,
|
||||
'border-t-0': panelState.value.order === panelsCount.value - 1,
|
||||
'border-x-0': accordionState.value.flush,
|
||||
}))
|
||||
return {
|
||||
contentClasses,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { computed, inject } from 'vue'
|
||||
import { useAccordionState } from '@/components/Accordion/composables/useAccordionState'
|
||||
import classNames from 'classnames'
|
||||
|
||||
|
||||
const baseHeaderClasses = 'flex items-center p-5 w-full font-medium text-left text-gray-500 border border-gray-200 focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 dark:border-gray-700 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800'
|
||||
const baseArrowClasses = 'w-6 h-6 shrink-0'
|
||||
export function useAccordionHeaderClasses() {
|
||||
const accordionId: string = inject('accordionId') ?? ''
|
||||
const panelId: string = inject('panelId') ?? ''
|
||||
|
||||
const { accordionsStates } = useAccordionState()
|
||||
const accordionState = computed(() => accordionsStates[accordionId])
|
||||
const panelState = computed(() => accordionState.value.panels[panelId])
|
||||
const panelsCount = computed(() => Object.keys(panelState.value).length)
|
||||
const isPanelLast = computed(() => panelState.value.order !== panelsCount.value - 1)
|
||||
const isBottomBorderVisibleForFlush = computed(() =>
|
||||
isPanelLast.value ||
|
||||
(accordionState.value.flush && panelState.value.order === panelsCount.value - 1 && !panelState.value.isVisible))
|
||||
|
||||
const headerClasses = computed(() => classNames(baseHeaderClasses, {
|
||||
'bg-gray-100 dark:bg-gray-800': panelState.value.isVisible,
|
||||
'rounded-t-xl': panelState.value.order === 0 && !accordionState.value.flush,
|
||||
'border-t-0': panelState.value.order === 0 && accordionState.value.flush,
|
||||
'border-b-0': isBottomBorderVisibleForFlush.value,
|
||||
'border-x-0': accordionState.value.flush,
|
||||
}))
|
||||
const arrowClasses = computed(() => classNames(baseArrowClasses,{ 'rotate-180': panelState.value.isVisible }))
|
||||
return {
|
||||
headerClasses,
|
||||
arrowClasses,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { onBeforeMount, onBeforeUnmount, reactive } from 'vue'
|
||||
import type { tAccordionMode, tState } from '@/components/Accordion/types'
|
||||
import type { tState } from '@/components/Accordion/types'
|
||||
|
||||
const accordionsStates = reactive<tState>({})
|
||||
export function useAccordionState(id?: string, options?: {flush: boolean, alwaysOpen: boolean}): {
|
||||
|
||||
Reference in New Issue
Block a user