generated from nl-design-system/example
-
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.
Co-authored-by: Mark Teekman <[email protected]>
- Loading branch information
1 parent
c4954c6
commit 94e92a9
Showing
7 changed files
with
310 additions
and
68 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
121 changes: 121 additions & 0 deletions
121
packages/storybook/src/css-utrecht-accordion.stories.tsx
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,121 @@ | ||
/* @license CC0-1.0 */ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { AccordionProvider } from '@utrecht/component-library-react/dist/css-module'; | ||
import { ReactNode } from 'react'; | ||
import readme from './documentation/accordion.md?raw'; | ||
|
||
interface AccordionStoryProps { | ||
label: string; | ||
body: ReactNode; | ||
expanded?: boolean; | ||
expandedAccordion?: boolean; | ||
} | ||
|
||
const AccordionStory = ({ expanded, label, body }: AccordionStoryProps) => ( | ||
<AccordionProvider sections={[{ expanded, label, body }]} /> | ||
); | ||
|
||
const meta = { | ||
title: 'CSS Component/Accordion', | ||
id: 'css-utrecht-accordion', | ||
component: AccordionProvider, | ||
args: { | ||
// @ts-ignore | ||
label: '', | ||
body: '', | ||
expandedAccordion: false, | ||
}, | ||
argTypes: { | ||
// @ts-ignore | ||
label: { | ||
name: 'label', | ||
type: { name: 'string', required: true }, | ||
table: { | ||
defaultValue: { summary: '' }, | ||
category: 'API', | ||
}, | ||
}, | ||
body: { | ||
name: 'body', | ||
type: { name: 'string', required: true }, | ||
table: { | ||
defaultValue: { summary: '' }, | ||
category: 'API', | ||
}, | ||
}, | ||
expandedAccordion: { | ||
name: 'expandedAccordion', | ||
type: { name: 'boolean', required: false }, | ||
table: { | ||
defaultValue: { summary: false }, | ||
category: 'API', | ||
}, | ||
}, | ||
}, | ||
tags: ['autodocs'], | ||
parameters: { | ||
design: { | ||
type: 'figma', | ||
url: 'https://www.figma.com/design/ck81CE8SNzePi30jCEu7MK/NLDS---Gemeente-Tilburg---Bibliotheek?node-id=1261%3A4784&t=lu24fBlSHdl7JcKT-1', | ||
}, | ||
docs: { | ||
description: { | ||
component: readme, | ||
}, | ||
}, | ||
}, | ||
// @ts-ignore | ||
render: AccordionStory, | ||
} satisfies Meta<typeof AccordionProvider>; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
// @ts-ignore | ||
args: { | ||
label: 'Lorem ipsum', | ||
body: `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. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla | ||
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est | ||
laborum.`, | ||
expandedAccordion: true, | ||
}, | ||
}; | ||
|
||
const accordionData = [ | ||
{ | ||
label: 'Lorem ipsum 1', | ||
body: `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. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla | ||
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est | ||
laborum.`, | ||
expandedAccordion: true, | ||
}, | ||
{ | ||
label: 'Lorem ipsum 2', | ||
body: `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. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla | ||
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est | ||
laborum.`, | ||
expandedAccordion: false, | ||
}, | ||
{ | ||
label: 'Lorem ipsum 3', | ||
body: `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. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla | ||
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est | ||
laborum.`, | ||
expandedAccordion: false, | ||
}, | ||
]; | ||
|
||
// @ts-ignore | ||
export const Multiple: Story = { | ||
render: () => <AccordionProvider sections={accordionData} />, | ||
}; |
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,3 @@ | ||
# Accordion | ||
|
||
The accordion component is a container that can be collapsed and expanded. It is used to hide and show content. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
proprietary/design-tokens/src/common/tilburg/line.tokens.json
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,14 @@ | ||
{ | ||
"tilburg": { | ||
"line": { | ||
"border-color": { | ||
"value": "{tilburg.color.gray.200}", | ||
"type": "color" | ||
}, | ||
"border-width": { | ||
"value": "{tilburg.border-width.sm}", | ||
"type": "borderWidth" | ||
} | ||
} | ||
} | ||
} |
166 changes: 166 additions & 0 deletions
166
proprietary/design-tokens/src/components/utrecht/accordion.tokens.json
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,166 @@ | ||
{ | ||
"utrecht": { | ||
"accordion": { | ||
"border-radius": { | ||
"type": "borderRadius", | ||
"value": "0px" | ||
}, | ||
"section": { | ||
"border-block-end-width": { | ||
"type": "borderWidth", | ||
"value": "{tilburg.border-width.sm}" | ||
}, | ||
"border-width": { | ||
"type": "borderWidth", | ||
"value": "auto" | ||
}, | ||
"border-color": { | ||
"value": "{tilburg.line.border-color}", | ||
"type": "color" | ||
} | ||
}, | ||
"panel": { | ||
"border-color": { | ||
"value": "transparent", | ||
"type": "color" | ||
}, | ||
"border-width": { | ||
"type": "borderWidth", | ||
"value": "{tilburg.border-width.lg}" | ||
}, | ||
"padding-block-end": { | ||
"value": "{tilburg.space.block.rabbit}", | ||
"type": "spacing" | ||
}, | ||
"padding-block-start": { | ||
"value": "{tilburg.space.block.rabbit}", | ||
"type": "spacing" | ||
}, | ||
"padding-inline-end": { | ||
"value": "{tilburg.space.inline.mouse}", | ||
"type": "spacing" | ||
}, | ||
"padding-inline-start": { | ||
"value": "{tilburg.space.inline.mouse}", | ||
"type": "spacing" | ||
} | ||
}, | ||
"button": { | ||
"font-size": { | ||
"value": "{tilburg.document.font-size}", | ||
"type": "fontSizes" | ||
}, | ||
"line-height": { | ||
"value": "{tilburg.document.line-height}", | ||
"type": "lineHeights" | ||
}, | ||
"icon": { | ||
"margin-inline": { | ||
"value": "{tilburg.space.text.mouse}", | ||
"type": "spacing" | ||
}, | ||
"size": { | ||
"type": "sizing", | ||
"value": "{tilburg.icon.functional.size}" | ||
} | ||
}, | ||
"padding-block-end": { | ||
"value": "{tilburg.space.block.snail}", | ||
"type": "spacing" | ||
}, | ||
"padding-block-start": { | ||
"value": "{tilburg.space.block.snail}", | ||
"type": "spacing" | ||
}, | ||
"padding-inline-end": { | ||
"value": "{tilburg.space.inline.mouse}", | ||
"type": "spacing" | ||
}, | ||
"padding-inline-start": { | ||
"value": "{tilburg.space.inline.mouse}", | ||
"type": "spacing" | ||
}, | ||
"hover": { | ||
"background-color": { | ||
"type": "color", | ||
"value": "{tilburg.color.gray.100}" | ||
}, | ||
"border-color": { | ||
"value": "transparent", | ||
"type": "color" | ||
}, | ||
"color": { | ||
"type": "color", | ||
"value": "{tilburg.interaction.hover.color}" | ||
} | ||
}, | ||
"expanded": { | ||
"background-color": { | ||
"value": "{tilburg.color.gray.50}", | ||
"type": "color" | ||
}, | ||
"border-color": { | ||
"value": "transparent", | ||
"type": "color" | ||
}, | ||
"color": { | ||
"type": "color", | ||
"value": "{tilburg.interaction.color}" | ||
} | ||
}, | ||
"background-color": { | ||
"type": "color", | ||
"value": "{tilburg.color.gray.50}" | ||
}, | ||
"border-color": { | ||
"value": "transparent", | ||
"type": "color" | ||
}, | ||
"color": { | ||
"type": "color", | ||
"value": "{tilburg.interaction.color}" | ||
}, | ||
"focus": { | ||
"background-color": { | ||
"type": "color", | ||
"value": "{tilburg.focus.background-color}" | ||
}, | ||
"border-color": { | ||
"value": "transparent", | ||
"type": "color" | ||
}, | ||
"color": { | ||
"type": "color", | ||
"value": "{tilburg.focus.color}" | ||
} | ||
}, | ||
"active": { | ||
"background-color": { | ||
"type": "color", | ||
"value": "{tilburg.color.gray.200}" | ||
}, | ||
"border-color": { | ||
"value": "transparent", | ||
"type": "color" | ||
}, | ||
"color": { | ||
"type": "color", | ||
"value": "{tilburg.interaction.active.color}" | ||
} | ||
}, | ||
"border-width": { | ||
"type": "borderWidth", | ||
"value": "{tilburg.border-width.sm}" | ||
}, | ||
"font-family": { | ||
"value": "{tilburg.document.font-family}", | ||
"type": "fontFamilies" | ||
}, | ||
"font-weight": { | ||
"value": "{tilburg.document.strong.font-weight}", | ||
"type": "fontWeights" | ||
} | ||
} | ||
} | ||
} | ||
} |