Skip to content

Commit

Permalink
epic: various component improvements (#1173)
Browse files Browse the repository at this point in the history
* feat: improve Tag and Link colour contrast (#1172)

* feat: improve Button styling and accessibility (#1174)

BREAKING CHANGE: deprecate grey Button kind

* chore: prettier
  • Loading branch information
brettdorrans authored Aug 28, 2022
1 parent ba5def9 commit c65cf85
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Montserrat:400,500,600,700" />
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Montserrat:400,500,700" />
19 changes: 15 additions & 4 deletions src/components/button/Button.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,33 @@ test('it works with size large', () => {
expect(container.firstChild).toMatchSnapshot();
});

test('it works with ghost', () => {
test('it works with loading', () => {
const { container } = setup(
<Button type="button" kind="secondary" ghost>
<Button type="button" kind="secondary" loading>
Hello world
</Button>
);
expect(container.firstChild).toMatchSnapshot();
});

test('it works with loading', () => {
test('it works with anchor', () => {
const { container } = setup(
<Button type="button" kind="secondary" loading>
<Button
as="a"
kind="secondary"
href="https://google.com"
target="_blank"
>
Hello world
</Button>
);
expect(container.firstChild).toMatchSnapshot();
expect(container.querySelectorAll('a').length).toBe(1);
expect(container.querySelector('a')).toHaveAttribute(
'href',
'https://google.com'
);
expect(container.querySelector('a')).toHaveAttribute('target', '_blank');
});

test('it works with icon', () => {
Expand Down
15 changes: 9 additions & 6 deletions src/components/button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ Danger.args = {
styles: templateStyles
};

export const Grey = DefaultTemplate.bind({});
Grey.args = {
kind: 'grey',
styles: templateStyles
};

export const WithIcon = DefaultTemplate.bind({});
WithIcon.args = {
kind: 'primary',
icon: faXmark,
styles: templateStyles
};

export const AsAnchor = DefaultTemplate.bind({});
AsAnchor.args = {
as: 'a',
kind: 'primary',
href: 'https://google.com',
target: '_blank',
styles: templateStyles
};
Loading

0 comments on commit c65cf85

Please sign in to comment.