generated from nl-design-system/example
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
209 additions
and
0 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,9 @@ | ||
<!-- @license CC0-1.0 --> | ||
|
||
# Button group | ||
|
||
De _button group_ is een container voor een aantal buttons, of voor een losstaande button. | ||
|
||
## Verticale variant | ||
|
||
Voor smalle schermen bij plaatsing in smalle panelen (zoals een sidebar) is er een variant waar buttons onder elkaar staan, in plaats van naast elkaar. Gebruik deze variant niet wanneer er voldoende ruimte is voor de standaard variant. Je kunt bijvoorbeeld CSS media queries gebruiken om deze variant toe te passen voor kleine schermen. |
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,34 @@ | ||
/** | ||
* @license EUPL-1.2 | ||
* Copyright (c) 2022 Frameless B.V. | ||
*/ | ||
|
||
.utrecht-button-group { | ||
background-color: var(--utrecht-button-group-background-color); | ||
display: flex; | ||
min-block-size: var(--utrecht-button-block-size); | ||
padding-block-end: var(--utrecht-button-group-padding-block-end); | ||
padding-block-start: var(--utrecht-button-group-padding-block-start); | ||
} | ||
|
||
.utrecht-button-group--distance { | ||
margin-block-end: var(--utrecht-button-group-margin-block-end); | ||
margin-block-start: var(--utrecht-button-group-margin-block-start); | ||
} | ||
|
||
.utrecht-button-group, | ||
.utrecht-button-group--horizontal { | ||
gap: var(--utrecht-button-group-inline-gap, 1em); | ||
} | ||
|
||
.utrecht-button-group__button-link--horizontal, | ||
.utrecht-button-group--horizontal .utrecht-button-link, | ||
.utrecht-button-group:not(.utrecht-button-group--vertical) .utrecht-button-link { | ||
--utrecht-button-padding-inline-end: 0; | ||
--utrecht-button-padding-inline-start: 0; | ||
} | ||
|
||
.utrecht-button-group--vertical { | ||
flex-direction: column; | ||
gap: var(--utrecht-button-group-block-gap, 1em); | ||
} |
45 changes: 45 additions & 0 deletions
45
components/button-group/css/stories/01-default.stories.mdx
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,45 @@ | ||
<!-- @license CC0-1.0 --> | ||
|
||
import { ArgsTable, Canvas, Meta, Story } from "@storybook/addon-docs"; | ||
import { Button } from "../../../button/bem"; | ||
import { ButtonGroup, defaultArgs } from "../template"; | ||
import "../index.scss"; | ||
|
||
<Meta | ||
id="css-button-group" | ||
title="CSS Component/Button group" | ||
argTypes={{ | ||
direction: { | ||
control: { type: "select" }, | ||
description: "Direction", | ||
options: ["", "horizontal", "vertical"], | ||
}, | ||
innerHTML: { | ||
description: "HTML content", | ||
control: "text", | ||
}, | ||
}} | ||
parameters={{ | ||
status: { | ||
type: "WORK IN PROGRESS", | ||
}, | ||
}} | ||
/> | ||
|
||
# Button group | ||
|
||
Styling via the `.utrecht-button-group` class name: | ||
|
||
<Canvas> | ||
<Story | ||
name="Default" | ||
args={{ | ||
...defaultArgs, | ||
innerHTML: [Button({ textContent: "Save and continue" }), Button({ textContent: "Back" })].join("\n"), | ||
}} | ||
> | ||
{ButtonGroup.bind({})} | ||
</Story> | ||
</Canvas> | ||
|
||
<ArgsTable story="Default" /> |
33 changes: 33 additions & 0 deletions
33
components/button-group/css/stories/02-vertical.stories.mdx
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,33 @@ | ||
<!-- @license CC0-1.0 --> | ||
|
||
import { Canvas, Meta, Story } from "@storybook/addon-docs"; | ||
import { Button } from "../../../button/bem"; | ||
import { ButtonGroup, defaultArgs } from "../template"; | ||
import "../index.scss"; | ||
|
||
<Meta | ||
id="css-button-group" | ||
title="CSS Component/Button group" | ||
parameters={{ | ||
status: { | ||
type: "WORK IN PROGRESS", | ||
}, | ||
}} | ||
/> | ||
|
||
# Vertical button group | ||
|
||
Styling via the `.utrecht-button-group--vertical` class name: | ||
|
||
<Canvas> | ||
<Story | ||
name="--vertical" | ||
args={{ | ||
...defaultArgs, | ||
direction: "vertical", | ||
innerHTML: [Button({ textContent: "Save and continue" }), Button({ textContent: "Back" })].join("\n"), | ||
}} | ||
> | ||
{ButtonGroup.bind({})} | ||
</Story> | ||
</Canvas> |
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,8 @@ | ||
<!-- @license CC0-1.0 --> | ||
|
||
import { Description, Meta } from "@storybook/addon-docs"; | ||
import document from "../../README.md"; | ||
|
||
<Meta id="css-button-group" title="CSS Component/Button group/README" /> | ||
|
||
<Description>{document}</Description> |
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,16 @@ | ||
<!-- @license CC0-1.0 --> | ||
|
||
import { Meta } from "@storybook/addon-docs"; | ||
import { ComponentTokensSection } from "../../../../documentation/components/ComponentTokensSection"; | ||
import tokens from "../../../../proprietary/design-tokens/dist/index.json"; | ||
import tokensDefinition from "../../tokens.json"; | ||
|
||
<Meta id="css-button-group--design-tokens" title="CSS Component/Button group/Design Tokens" /> | ||
|
||
# Design Tokens | ||
|
||
<ComponentTokensSection | ||
tokens={tokens} | ||
definition={tokensDefinition} | ||
component="utrecht-button-group" | ||
></ComponentTokensSection> |
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,13 @@ | ||
import clsx from 'clsx'; | ||
|
||
export const defaultArgs = { | ||
direction: 'horizontal', | ||
innerHTML: '', | ||
}; | ||
|
||
export const ButtonGroup = ({ innerHTML = '', direction = 'horizontal' }) => | ||
`<div class="${clsx( | ||
'utrecht-button-group', | ||
direction === 'horizontal' && 'utrecht-button-group--horizontal', | ||
direction === 'vertical' && 'utrecht-button-group--vertical', | ||
)}" role="group">${innerHTML}</div>`; |
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,50 @@ | ||
{ | ||
"utrecht": { | ||
"button-group": { | ||
"background-color": { | ||
"css": { | ||
"syntax": "<color>", | ||
"inherits": true | ||
} | ||
}, | ||
"column-gap": { | ||
"css": { | ||
"syntax": "<length>", | ||
"inherits": true | ||
}, | ||
"comment": "'column-gap', for lack of a better existing property" | ||
}, | ||
"margin-block-end": { | ||
"css": { | ||
"syntax": "<length>", | ||
"inherits": true | ||
} | ||
}, | ||
"margin-block-start": { | ||
"css": { | ||
"syntax": "<length>", | ||
"inherits": true | ||
} | ||
}, | ||
"padding-block-end": { | ||
"css": { | ||
"syntax": "<length>", | ||
"inherits": true | ||
} | ||
}, | ||
"padding-block-start": { | ||
"css": { | ||
"syntax": "<length>", | ||
"inherits": true | ||
} | ||
}, | ||
"row-gap": { | ||
"css": { | ||
"syntax": "<length>", | ||
"inherits": true | ||
}, | ||
"comment": "'row-gap', for lack of a better existing property" | ||
} | ||
} | ||
} | ||
} |
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