feat: added option to pass classes to header and content

This commit is contained in:
victor
2022-12-08 10:20:54 +04:00
parent d9b2dfd9a4
commit c78a56810b
2 changed files with 14 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="vp-raw flex flex-col"> <div class="vp-raw flex flex-col">
<Accordion :items="items" flush> <Accordion :items="items" content-classes="bg-red-100">
<div> <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="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> <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>

View File

@@ -4,8 +4,11 @@
<h2> <h2>
<button <button
type="button" type="button"
:class="[
{ 'rounded-t-xl border-b-0': i === 0 },
headerClasses
]"
class="flex justify-between 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="flex justify-between 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="{'rounded-t-xl border-b-0': i === 0}"
@click="toggleItem(item)" @click="toggleItem(item)"
> >
<span>{{item.header}}</span> <span>{{item.header}}</span>
@@ -21,7 +24,10 @@
</svg> </svg>
</button> </button>
</h2> </h2>
<div :class="{hidden: !item.isVisible}" class="p-5 border [&:not(:last-item)]:border-b-0 last:border-t-0 border-gray-200 dark:border-gray-700 dark:bg-gray-900"> <div
:class="[ { hidden: !item.isVisible }, contentClasses ]"
class="p-5 border [&:not(:last-item)]:border-b-0 last:border-t-0 border-gray-200 dark:border-gray-700 dark:bg-gray-900"
>
<slot /> <slot />
</div> </div>
</template> </template>
@@ -38,7 +44,11 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
arrowIcon: { headerClasses: {
type: String,
default: '',
},
contentClasses: {
type: String, type: String,
default: '', default: '',
}, },