generated from druxt/module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(#138): accordion template * chore(#138): update accordion and related --------- Co-authored-by: Brian Gilbert <[email protected]>
- Loading branch information
1 parent
5c0ceae
commit 9af8a98
Showing
4 changed files
with
144 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import CTAccordion from './Accordion.vue' | ||
|
||
export default { | ||
title: 'CivicTheme/Molecules/Accordion', | ||
component: CTAccordion, | ||
argTypes: { | ||
theme: { | ||
options: ['dark', 'light'], | ||
control: 'select' | ||
}, | ||
}, | ||
parameters: { | ||
status: { | ||
type: 'beta', | ||
} | ||
} | ||
} | ||
|
||
const Template = (args, { argTypes }) => { | ||
return { | ||
props: Object.keys(argTypes), | ||
template: `<CTAccordion v-bind="$props" v-on="$props"> | ||
<template v-if="$props.default">{{ $props.default }}</template> | ||
</CTAccordion>`, | ||
} | ||
} | ||
|
||
export const Default = Template.bind({}) | ||
Default.storyName = 'Accordion' | ||
Default.args = { | ||
background: false, | ||
expandAll: true, | ||
panels: [ | ||
{ title: 'Accordion title 1', content: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur harum magnam modi obcaecati vitae voluptatibus! Accusamus atque deleniti, distinctio esse facere, nam odio officiis omnis porro quibusdam quis repudiandae veritatis.', id: 0 }, | ||
{ title: 'Accordion title 2', content: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur harum magnam modi obcaecati vitae voluptatibus! Accusamus atque deleniti, distinctio esse facere, nam odio officiis omnis porro quibusdam quis repudiandae veritatis.', id: 1 }, | ||
{ title: 'Accordion title 3', content: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur harum magnam modi obcaecati vitae voluptatibus! Accusamus atque deleniti, distinctio esse facere, nam odio officiis omnis porro quibusdam quis repudiandae veritatis.', id: 2 }, | ||
] | ||
} |
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,79 @@ | ||
<template> | ||
<div | ||
class="ct-accordion" | ||
:class="{ | ||
[themeClass]: true, | ||
'ct-accordion--with-background': background | ||
}" | ||
> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-xxs-12"> | ||
<!-- Slot: Content Top --> | ||
<div v-if="$slots['content_top']" class="ct-accordion__content-top"> | ||
{{ content_top }} | ||
</div> | ||
|
||
<div class="ct-accordion__content"> | ||
<ul class="ct-accordion__panels"> | ||
<CTCollapsible | ||
v-for="(panel, delta) of panels" | ||
:collapsed="!expandAll && !panel.expanded" | ||
class="ct-accordion__panels__panel" | ||
data-collapsible-duration="250" | ||
data-collapsible-trigger-wide="" | ||
:key="`panel-${delta}`" | ||
panel-class="ct-accordion__panels__panel__content" | ||
tag="li" | ||
> | ||
<template #trigger> | ||
<div class="ct-accordion__panels__panel__header"> | ||
<CTButton | ||
class="ct-accordion__panels__panel__header__button" | ||
data-collapsible-trigger="" | ||
:text="panel.title" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<CTParagraph class="ct-accordion__panels__panel__content__inner"> | ||
<slot name="panel" :panel="{ panel }"> | ||
{{ panel.content }} | ||
</slot> | ||
</CTParagraph> | ||
</CTCollapsible> | ||
</ul> | ||
</div> | ||
|
||
<!-- Slot: Content Top --> | ||
<div v-if="$slots['content_bottom']" class="ct-accordion__content-bottom"> | ||
{{ content_bottom }} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import ThemeMixin from '../mixins/theme' | ||
export default { | ||
mixins: [ThemeMixin], | ||
props: { | ||
background: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
expandAll: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
panels: { | ||
type: Array, | ||
default: () => ([]) | ||
} | ||
} | ||
} | ||
</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