generated from nl-design-system/example
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Depends on #483 closes #456 --------- Co-authored-by: Ruben Smit <[email protected]> Co-authored-by: Rozerin <[email protected]> Co-authored-by: Robbert <[email protected]>
- Loading branch information
1 parent
20fe189
commit 528462b
Showing
12 changed files
with
199 additions
and
23 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,5 @@ | ||
@import "../node_modules/@utrecht/components/accordion/src/"; | ||
|
||
.utrecht-accordion__button { | ||
--utrecht-button-border-radius: var(--utrecht-accordion-border-radius); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,9 @@ | |
"access": "restricted", | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"devDependencies": { | ||
"@utrecht/components": "6.0.0" | ||
}, | ||
"repository": { | ||
"type": "git+ssh", | ||
"url": "[email protected]:nl-design-system/rijkshuisstijl-community.git", | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import '@rijkshuisstijl-community/components-css/index.scss'; | ||
|
||
export { | ||
Accordion, | ||
type AccordionProps, | ||
AccordionProvider, | ||
type AccordionProviderProps, | ||
AccordionSection, | ||
type AccordionSectionProps, | ||
type AccordionSectionProviderProps, | ||
} from '@utrecht/component-library-react/'; |
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 |
---|---|---|
@@ -1,5 +1,15 @@ | ||
// Export all Utrecht components | ||
export * from '@utrecht/component-library-react/dist/css-module'; | ||
|
||
// Export overwrites and new components | ||
export { | ||
Accordion, | ||
type AccordionProps, | ||
AccordionProvider, | ||
type AccordionProviderProps, | ||
AccordionSection, | ||
type AccordionSectionProps, | ||
type AccordionSectionProviderProps, | ||
} from './Accordion'; | ||
export { Logo } from './Logo'; | ||
export type { LogoProps } from './Logo'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- @license CC0-1.0 --> | ||
|
||
# Rijkshuisstijl Community accordion component |
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,137 @@ | ||
import { AccordionProvider, AccordionSectionProps } from '@rijkshuisstijl-community/components-react'; | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { UtrechtIconChevronDown } from '@utrecht/web-component-library-react'; | ||
import { ReactNode } from 'react'; | ||
import readme from './accordion.md?raw'; | ||
|
||
interface AccordionStoryProps { | ||
label: string; | ||
body: ReactNode; | ||
expanded?: boolean; | ||
expandedAccordion?: boolean; | ||
icon?: ReactNode; | ||
appearance?: string; | ||
sections?: AccordionSectionProps[]; | ||
} | ||
|
||
const AccordionStory = ({ expanded, label, body, appearance, icon, sections }: AccordionStoryProps) => ( | ||
<AccordionProvider icon={icon} appearance={appearance} sections={sections || [{ expanded, label, body }]} /> | ||
); | ||
|
||
const meta = { | ||
title: 'Rijkshuisstijl/Accordion', | ||
id: 'react-accordion', | ||
args: { | ||
label: '', | ||
body: '', | ||
expandedAccordion: false, | ||
appearance: '', | ||
icon: undefined, | ||
}, | ||
argTypes: { | ||
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', | ||
}, | ||
}, | ||
appearance: { | ||
description: 'Appearance', | ||
control: { type: 'select' }, | ||
options: ['', 'utrecht'], | ||
}, | ||
icon: { | ||
name: 'icon', | ||
description: 'Icon at the start', | ||
control: { type: 'select' }, | ||
options: { | ||
'': undefined, | ||
null: null, | ||
'utrecht-icon-chevron-down': <UtrechtIconChevronDown />, | ||
}, | ||
}, | ||
}, | ||
parameters: { | ||
tokensPrefix: 'utrecht-accordion', | ||
docs: { | ||
description: { | ||
component: readme, | ||
}, | ||
}, | ||
}, | ||
render: AccordionStory, | ||
} satisfies Meta<AccordionStoryProps>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
const accordionDefaultDataAR = { | ||
label: 'ما هو "لوريم إيبسوم" ؟', | ||
body: ' المحتوى) ويُستخدم في صناعات المطابع ودور النشر. كان لوريم إيبسوم ولايزال المعيار للنص الشكلي منذ القرن الخامس عشر عندما قامت مطبعة مجهولة برص مجموعة من الأحرف بشكل عشوائي أخذتها من نص، لتكوّن كتيّب بمثابة دليل أو مرجع شكلي لهذه الأحرف. خمسة قرون من الزمن لم تقضي على هذا النص، بل انه حتى صار مستخدماً وبشكله الأصلي في الطباعة والتنضيد الإلكتروني. انتشر بشكل كبير في ستينيّات هذا القرن مع إصدار رقائق "ليتراسيت" (Letraset) البلاستيكية تحوي مقاطع من هذا النص، وعاد لينتشر مرة أخرى مؤخراَ مع ظهور برامج النشر الإلكتروني مثل "ألدوس بايج مايكر" (Aldus PageMaker) والتي حوت أيضاً على نسخ من نص لوريم إيبسوم.', | ||
}; | ||
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, | ||
}, | ||
]; | ||
|
||
export const Default: Story = { | ||
args: { | ||
sections: accordionData, | ||
}, | ||
}; | ||
|
||
export const RTL: Story = { | ||
args: accordionDefaultDataAR, | ||
decorators: [ | ||
(Story) => ( | ||
<div lang="ar" dir="rtl"> | ||
{Story()} | ||
</div> | ||
), | ||
], | ||
name: 'Right-to-left', | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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