-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix icon-only buttons in small button groups (#101)
- Loading branch information
Showing
4 changed files
with
164 additions
and
44 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
122 changes: 122 additions & 0 deletions
122
src/nationalarchives/components/button/button-group.stories.js
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,122 @@ | ||
import Button from "./template.njk"; | ||
|
||
export default { | ||
title: "Components/Button group", | ||
}; | ||
|
||
const Template = ({ | ||
text, | ||
href, | ||
title, | ||
icon, | ||
accent, | ||
small, | ||
plain, | ||
iconOnly, | ||
iconOnlyOnMobile, | ||
rightAlignIcon, | ||
buttonElement, | ||
buttonType, | ||
classes, | ||
attributes, | ||
}) => | ||
Button({ | ||
params: { | ||
text, | ||
href, | ||
title, | ||
icon, | ||
accent, | ||
small, | ||
plain, | ||
iconOnly, | ||
iconOnlyOnMobile, | ||
rightAlignIcon, | ||
buttonElement, | ||
buttonType, | ||
classes, | ||
attributes, | ||
}, | ||
}); | ||
|
||
const GroupTemplate = ({ buttons }) => | ||
`<div class="tna-button-group"> | ||
${buttons.map((button) => Template(button)).join("")} | ||
</div>`; | ||
|
||
export const Group = GroupTemplate.bind({}); | ||
Group.args = { | ||
buttons: [ | ||
{ | ||
text: "Standard", | ||
href: "#", | ||
classes: "tna-button--demo", | ||
}, | ||
{ | ||
text: "Accent", | ||
href: "#", | ||
accent: true, | ||
classes: "tna-button--demo", | ||
}, | ||
{ | ||
text: "Icon", | ||
href: "#", | ||
icon: "phone", | ||
classes: "tna-button--demo", | ||
}, | ||
{ | ||
text: "Right Aligned Icon", | ||
href: "#", | ||
icon: "chevron-right", | ||
rightAlignIcon: true, | ||
classes: "tna-button--demo", | ||
}, | ||
{ | ||
text: "Icon Only", | ||
href: "#", | ||
icon: "list", | ||
iconOnly: true, | ||
classes: "tna-button--demo", | ||
}, | ||
{ | ||
text: "Icon Only On Mobile", | ||
href: "#", | ||
icon: "list", | ||
iconOnlyOnMobile: true, | ||
classes: "tna-button--demo", | ||
}, | ||
{ | ||
text: "Plain", | ||
plain: true, | ||
classes: "tna-button--demo", | ||
}, | ||
{ | ||
text: "Plain With Icon", | ||
href: "#", | ||
icon: "map-location-dot", | ||
plain: true, | ||
classes: "tna-button--demo", | ||
}, | ||
{ | ||
text: "Button", | ||
buttonElement: true, | ||
classes: "tna-button--demo", | ||
}, | ||
], | ||
}; | ||
|
||
const GroupOfSmallTemplate = ({ buttons }) => | ||
`<div class="tna-button-group"> | ||
${buttons.map((button) => Template({ ...button, text: `Small ${button.text}`, small: true })).join("")} | ||
</div>`; | ||
|
||
export const GroupOfSmall = GroupOfSmallTemplate.bind({}); | ||
GroupOfSmall.args = Group.args; | ||
|
||
const SmallGroupTemplate = ({ buttons }) => | ||
`<div class="tna-button-group tna-button-group--small"> | ||
${buttons.map((button) => Template({ ...button, text: `Small ${button.text}` })).join("")} | ||
</div>`; | ||
|
||
export const SmallGroup = SmallGroupTemplate.bind({}); | ||
SmallGroup.args = Group.args; |
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