-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QGDS-22-Accordion Init #247
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"id": "123", | ||
"heading": "Accordions expand and collapse sections of content.", | ||
"intro": "<p>There are 2 types of accordions available in the Design System, single action accordions and accordion groups.</p>", | ||
"theme": "dark", | ||
"toggle_all": true, | ||
"component": [ | ||
{ | ||
"com_id": "1", | ||
"title": "Accordion Heading 01", | ||
"content": "<p>Lorem ipsum dolor sit amet, <a href='#'>consectetur adipiscing</a> elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>" | ||
}, | ||
{ | ||
"com_id": "2", | ||
"title": "Accordion Heading 02", | ||
"content": "<p>Lorem ipsum dolor sit amet, <a href='#'>consectetur adipiscing</a> elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>" | ||
}, | ||
{ | ||
"com_id": "3", | ||
"title": "Accordion Heading 03", | ||
"content": "<p>Lorem ipsum dolor sit amet, <a href='#'>consectetur adipiscing</a> elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>" | ||
} | ||
] | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i thought this would have broken https://github.com/qld-gov-au/qgds-vanilla/blob/develop/src/components/_global/css/body/stories/allTypography.json but its not used there. Be aware that the move to removing the .data. wrapper does make it harder to do have a global template and just pass in a huge json file. like
now cant be auto including this template as its not conformant to the pattern used everywhere else. unsure how we should go forward on this. i.e. have this called internal which is more streamlined and have the accordion hbs re jig the array to pass through, or a js helper function added to do the rejig pass through to stay backwards compatible. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<section class="qld__body"> | ||
<div class="container-fluid"> | ||
|
||
{{#if heading}} | ||
<h2>{{heading}}</h2> | ||
{{/if}} | ||
|
||
{{#if intro}} | ||
{{{intro}}} | ||
{{/if}} | ||
|
||
<div class="qld__accordion-group qld__accordion-group--{{theme}}" id="accordion-group--{{id}}"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need to move away from qld__accordion-group--{{theme}} to just using the 'qld-{{theme}}' to css bloat. |
||
{{#if toggle_all}} | ||
<div class="qld__accordion__toggle"> | ||
<button class="qld__accordion__toggle-btn qld__accordion__toggle-btn--closed" type="button">Open all</button> | ||
</div> | ||
{{/if}} | ||
<ul class="qld__accordion-list"> | ||
{{#each component}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you have dropped {{#printAccordion metadata}} |
||
<li> | ||
<div class="qld__accordion"> | ||
<button class="qld__accordion__title js-qld__accordion qld__accordion--closed" aria-controls="{{../theme}}_{{../id}}_{{this.com_id}}" aria-expanded="false"> | ||
{{this.title}} | ||
</button> | ||
|
||
<div class="qld__accordion__body qld__accordion--closed" id="{{../theme}}_{{../id}}_{{this.com_id}}"> | ||
<div class="qld__accordion__body-wrapper"> | ||
{{{this.content}}} | ||
</div> | ||
</div> | ||
</div> | ||
</li> | ||
{{/each}} | ||
</ul> | ||
</div> | ||
</div> | ||
</section> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this for building or for browser runtime? |
||
* Back To Top component logic attached to an init() function. | ||
* This logic is imported by the component's entry file (index.js) and ships with the component. | ||
*/ | ||
|
||
export default { | ||
init() {}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/** | ||
* @file banner.stories.js | ||
* @description Storybook configuration file for the Accordion component. | ||
* @module accordion.stories | ||
*/ | ||
|
||
import { QGDS } from "../../js/index.js"; | ||
import mockupData from "./accordion.data.json"; | ||
|
||
export default { | ||
title: "Components / Accordion", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was |
||
render: (args) => { | ||
try { | ||
return new QGDS.Accordion({ data: args }).htmlstring; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is over engineered, just do
|
||
} catch (e) { | ||
return JSON.stringify(e) + JSON.stringify(args); | ||
} | ||
}, | ||
args: mockupData, | ||
argTypes: { | ||
theme: { | ||
control: "select", | ||
options: ["light", "alt", "dark", "dark-alt"], | ||
}, | ||
}, | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please put back the figma links
|
||
|
||
export const Light = { | ||
args: { | ||
...mockupData, | ||
theme: "light", | ||
heading: "Light Single.", | ||
toggle_all: false, | ||
id: "124", | ||
component: [ | ||
{ | ||
com_id: "1", | ||
title: "Accordion Heading 01", | ||
content: | ||
"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>", | ||
}, | ||
], | ||
}, | ||
}; | ||
export const Alt = { | ||
args: { | ||
...mockupData, | ||
theme: "alt", | ||
toggle_all: false, | ||
id: "125", | ||
component: [ | ||
{ | ||
com_id: "1", | ||
title: "Accordion Heading 01", | ||
content: | ||
"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>", | ||
}, | ||
], | ||
}, | ||
}; | ||
export const Dark = { | ||
args: { | ||
...mockupData, | ||
theme: "dark", | ||
toggle_all: false, | ||
id: "126", | ||
component: [ | ||
{ | ||
com_id: "1", | ||
title: "Accordion Heading 02", | ||
content: | ||
"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>", | ||
}, | ||
], | ||
}, | ||
}; | ||
export const DarkAlt = { | ||
args: { | ||
...mockupData, | ||
theme: "dark-alt", | ||
toggle_all: false, | ||
id: "127", | ||
component: [ | ||
{ | ||
com_id: "1", | ||
title: "Accordion Heading 02", | ||
content: | ||
"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>", | ||
}, | ||
], | ||
}, | ||
}; | ||
export const LightGroup = { | ||
args: { | ||
...mockupData, | ||
theme: "light", | ||
id: "128", | ||
}, | ||
}; | ||
export const LightAltGroup = { | ||
args: { | ||
...mockupData, | ||
theme: "alt", | ||
id: "129", | ||
}, | ||
}; | ||
export const DarkGroup = { | ||
args: { | ||
...mockupData, | ||
theme: "dark", | ||
id: "130", | ||
}, | ||
}; | ||
export const DarkAltGroup = { | ||
args: { | ||
...mockupData, | ||
theme: "dark-alt", | ||
id: "131", | ||
}, | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add back in the example html versions for css diffing.
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please rename to accordion.js and create a new global.js to pull in accordion.js (since global.js is used for the browser rollup). so you can find the browser code easily (instead of the 100+ globals) |
This file was deleted.
This file was deleted.
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.
this is replacing html/example1.json which is the qh hbs input data.
i do like how it is cleaned up but this is not backwards compatible. Which may be ok if that is how we want to move. But in doing so we need to ensure we provide a 'migration' readme or a js wrapper that takes the old style json and updates to the format required for the new hbs template. { thats if we want qh to be able to use this in the future }