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.
Fix alignment in
horizontal-term-line
& separate ButtonExpand
Fix alignment in `horizontal-term-line` & separate `ButtonExpand` - Correct alignment issues for horizontal-term-line - Remove unused `.horizontal-term-line__list` class - Extract `button.horizontal-term-line__expand` into separate `ButtonExpand` component for reusability
- Loading branch information
1 parent
17f35cb
commit b2ea9e9
Showing
6 changed files
with
78 additions
and
30 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
28 changes: 28 additions & 0 deletions
28
src/stories/Library/Buttons/button/button-expand/ButtonExpand.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,28 @@ | ||
import clsx from "clsx"; | ||
import { FC } from "react"; | ||
|
||
export type ButtonExpandProps = { | ||
showMore: boolean; | ||
setShowMore: (showMore: boolean) => void; | ||
}; | ||
|
||
const ButtonExpand: FC<ButtonExpandProps> = ({ showMore, setShowMore }) => { | ||
return ( | ||
<button | ||
className="button-expand" | ||
type="button" | ||
onClick={() => setShowMore(!showMore)} | ||
aria-label="Expand More" | ||
> | ||
<img | ||
className={clsx("button-expand__image", { | ||
"button-expand__image--expanded": showMore, | ||
})} | ||
src="icons/collection/ExpandMore.svg" | ||
alt="" | ||
/> | ||
</button> | ||
); | ||
}; | ||
|
||
export default ButtonExpand; |
12 changes: 12 additions & 0 deletions
12
src/stories/Library/Buttons/button/button-expand/button-expand.scss
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,12 @@ | ||
.button-expand { | ||
cursor: pointer; | ||
align-self: center; | ||
|
||
&__image { | ||
transition: transform 0.3s ease-in-out; | ||
|
||
&.button-expand__image--expanded { | ||
transform: scaleY(-1); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/stories/Library/Buttons/button/button-expand/button-expand.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,34 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import ButtonExpand, { ButtonExpandProps } from "./ButtonExpand"; | ||
|
||
export default { | ||
title: "Library / Buttons / Button Expand", | ||
component: ButtonExpand, | ||
parameters: {}, | ||
argTypes: { | ||
showMore: { | ||
control: { | ||
type: "boolean", | ||
}, | ||
title: { | ||
control: { | ||
type: "text", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} as ComponentMeta<typeof ButtonExpand>; | ||
|
||
const Template: ComponentStory<typeof ButtonExpand> = ( | ||
args: ButtonExpandProps | ||
) => <ButtonExpand {...args} />; | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
showMore: false, | ||
}; | ||
|
||
export const Expand = Template.bind({}); | ||
Expand.args = { | ||
showMore: true, | ||
}; |
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