This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
forked from danskernesdigitalebibliotek/dpl-design-system
-
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.
Refactor
RoxButton
into separate components RowButtons
and `RowBu…
…tton`. DDFFORM-3
- Loading branch information
1 parent
15cdaf9
commit 14bd2fa
Showing
8 changed files
with
71 additions
and
41 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
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 |
---|---|---|
@@ -1,30 +1,16 @@ | ||
import clsx from "clsx"; | ||
import { FC } from "react"; | ||
|
||
type RowButtonProps = { | ||
labels: string[]; | ||
className?: string; | ||
label: string; | ||
}; | ||
|
||
const RowButton: FC<RowButtonProps> = ({ labels, className }) => ( | ||
<div className={clsx("row-buttons", className)}> | ||
{labels.slice(0, 2).map((label) => ( | ||
<button | ||
className="row-button text-tags row-button__text capitalize-all" | ||
type="button" | ||
> | ||
{label} | ||
</button> | ||
))} | ||
{labels.length > 2 && ( | ||
<button | ||
className="row-button text-tags row-button__text capitalize-all" | ||
type="button" | ||
> | ||
... | ||
</button> | ||
)} | ||
</div> | ||
const RowButton: FC<RowButtonProps> = ({ label }) => ( | ||
<button | ||
className="row-button text-tags row-button__text capitalize-all" | ||
type="button" | ||
> | ||
{label} | ||
</button> | ||
); | ||
|
||
export default RowButton; |
35 changes: 35 additions & 0 deletions
35
src/stories/Library/Buttons/row-button/RowButtons.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,35 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import { withDesign } from "storybook-addon-designs"; | ||
import RowButtons from "./RowButtons"; | ||
|
||
export default { | ||
title: "Library / Buttons / RowButtons", | ||
component: RowButtons, | ||
decorators: [withDesign], | ||
argTypes: { | ||
labels: { | ||
defaultValue: ["Netmedier"], | ||
}, | ||
}, | ||
parameters: { | ||
design: { | ||
type: "figma", | ||
url: "https://www.figma.com/file/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?type=design&node-id=7880%3A59070&mode=dev", | ||
}, | ||
layout: "centered", | ||
}, | ||
} as ComponentMeta<typeof RowButtons>; | ||
|
||
const Template: ComponentStory<typeof RowButtons> = (args) => ( | ||
<RowButtons {...args} /> | ||
); | ||
|
||
export const TwoButtons = Template.bind({}); | ||
TwoButtons.args = { | ||
labels: ["Netmedier", "Licenser"], | ||
}; | ||
|
||
export const ThreeAndMoreButtons = Template.bind({}); | ||
ThreeAndMoreButtons.args = { | ||
labels: ["Netmedier", "Licenser", "This is hiddden"], | ||
}; |
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,19 @@ | ||
import clsx from "clsx"; | ||
import { FC } from "react"; | ||
import RowButton from "./RowButton"; | ||
|
||
type RowButtonProps = { | ||
labels: string[]; | ||
className?: string; | ||
}; | ||
|
||
const RowButtons: FC<RowButtonProps> = ({ labels, className }) => ( | ||
<div className={clsx("row-buttons", className)}> | ||
{labels.slice(0, 2).map((label) => ( | ||
<RowButton label={label} /> | ||
))} | ||
{labels.length > 2 && <RowButton label="..." />} | ||
</div> | ||
); | ||
|
||
export default RowButtons; |
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,4 @@ | ||
.row-buttons { | ||
display: flex; | ||
flex-direction: row; | ||
} |
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