Skip to content

Commit

Permalink
chore: Split button permutations dev page in two (#3125)
Browse files Browse the repository at this point in the history
  • Loading branch information
jperals authored Dec 10, 2024
1 parent d6ee60f commit eb6aa8c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 8 deletions.
52 changes: 52 additions & 0 deletions pages/button/external.permutations.page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import React from 'react';

import Button, { ButtonProps } from '~components/button';

import createPermutations from '../utils/permutations';
import PermutationsView from '../utils/permutations-view';
import ScreenshotArea from '../utils/screenshot-area';

const permutations = createPermutations<ButtonProps>([
{
disabled: [false, true],
loading: [false, true],
iconName: [undefined, 'settings'],
iconAlign: ['left', 'right'],
external: [true],
children: [
'Button',
<>
<em>Custom</em> content
</>,
],
href: [undefined, '/choco/home'],
variant: ['normal', 'primary'],
},
{
variant: ['inline-link'],
external: [false, true],
iconName: [undefined, 'download'],
iconAlign: ['left', 'right'],
children: ['Inline link'],
loading: [false, true],
disabled: [false, true],
},
]);

export default function ButtonPermutations() {
return (
<>
<h1>External button permutations</h1>
<ScreenshotArea disableAnimations={true}>
<PermutationsView
permutations={permutations}
render={permutation => (
<Button {...permutation} i18nStrings={{ externalIconAriaLabel: '(opens in a new tab)' }} />
)}
/>
</ScreenshotArea>
</>
);
}
9 changes: 1 addition & 8 deletions pages/button/permutations.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const permutations = createPermutations<ButtonProps>([
loading: [false, true],
iconName: [undefined, 'settings'],
iconAlign: ['left', 'right'],
external: [false, true],
children: [
'Button',
<>
Expand Down Expand Up @@ -86,7 +85,6 @@ const permutations = createPermutations<ButtonProps>([
},
{
variant: ['inline-link'],
external: [false, true],
iconName: [undefined, 'download'],
iconAlign: ['left', 'right'],
children: ['Inline link'],
Expand All @@ -100,12 +98,7 @@ export default function ButtonPermutations() {
<>
<h1>Button permutations</h1>
<ScreenshotArea disableAnimations={true}>
<PermutationsView
permutations={permutations}
render={permutation => (
<Button {...permutation} i18nStrings={{ externalIconAriaLabel: '(opens in a new tab)' }} />
)}
/>
<PermutationsView permutations={permutations} render={permutation => <Button {...permutation} />} />
</ScreenshotArea>
</>
);
Expand Down

0 comments on commit eb6aa8c

Please sign in to comment.