Skip to content

Commit

Permalink
feat(v-collapsible): add new hideIcon prop
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitano committed Apr 8, 2022
1 parent 3e28328 commit 3a8944c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/collapsible/src/VCollapsible.stories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Story} from '@storybook/vue3';
import {ref} from 'vue';
import MyCollapse from './VCollapse.vue';
// import MyCollapse from './VCollapse.vue';
import MyCollapsible from './VCollapsible.vue';
import MyCollapsibleGroup from './VCollapsibleGroup.vue';

Expand All @@ -9,6 +9,7 @@ export default {
component: MyCollapsible,
args: {
modelValue: false,
hideIcon: false,
title: 'Title',
headerClass: 'font-semibold',
activeClass: '',
Expand Down Expand Up @@ -43,6 +44,11 @@ AutoOpen.args = {
modelValue: true,
};

export const HideIcon = Template.bind({});
HideIcon.args = {
hideIcon: true,
};

export const CustomClasses = Template.bind({});
CustomClasses.args = {
headerClass: '',
Expand All @@ -66,7 +72,7 @@ CustomClasses.args = {
// </MyCollapsible>`,
// });

export const Accordion = (args) => ({
export const Accordion: Story = (args) => ({
components: {MyCollapsibleGroup, MyCollapsible},
setup() {
const items = Array.from({length: 5}, (v, k) => ({
Expand Down
5 changes: 5 additions & 0 deletions packages/collapsible/src/VCollapsible.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const props = defineProps({
type: String,
default: 'px-4 pb-4',
},
hideIcon: {
type: Boolean,
default: false,
},
});
const {
Expand Down Expand Up @@ -99,6 +103,7 @@ watch(isOpen, (value) => {

<slot name="icon">
<ChevronDownIcon
v-if="!hideIcon"
class="w-5 h-5 transform transition duration-300"
:class="[isOpen ? 'rotate-180' : '']"
/>
Expand Down

0 comments on commit 3a8944c

Please sign in to comment.