diff --git a/tools/ui-components/src/button/button.stories.tsx b/tools/ui-components/src/button/button.stories.tsx
index 1650aecfeaf..dc01dd5e055 100644
--- a/tools/ui-components/src/button/button.stories.tsx
+++ b/tools/ui-components/src/button/button.stories.tsx
@@ -14,7 +14,8 @@ const story = {
'size',
'disabled',
'block',
- 'to',
+ 'href',
+ 'download',
'target',
'onClick'
]
@@ -41,7 +42,10 @@ const story = {
onClick: {
action: 'clicked'
},
- to: {
+ href: {
+ control: { type: 'text' }
+ },
+ download: {
control: { type: 'text' }
}
}
@@ -95,7 +99,14 @@ FullWidth.args = {
export const AsALink = Template.bind({});
AsALink.args = {
children: "I'm a link that looks like a button",
- to: 'https://www.freecodecamp.org'
+ href: 'https://www.freecodecamp.org'
+};
+
+export const AsADownloadLink = Template.bind({});
+AsALink.args = {
+ children: "I'm a link that looks like a button",
+ href: 'https://www.freecodecamp.org',
+ download: 'download.txt'
};
export default story;
diff --git a/tools/ui-components/src/button/button.test.tsx b/tools/ui-components/src/button/button.test.tsx
index 689a29cc0a8..2498d61c6de 100644
--- a/tools/ui-components/src/button/button.test.tsx
+++ b/tools/ui-components/src/button/button.test.tsx
@@ -72,8 +72,8 @@ describe('Button', () => {
expect(onClick).not.toBeCalled();
});
- it('should render an anchor element if the `to` prop is defined', () => {
- render();
+ it('should render an anchor element if the `href` prop is defined', () => {
+ render();
const link = screen.getByRole('link', { name: /freeCodeCamp/i });
const button = screen.queryByRole('button', { name: /freeCodeCamp/i });
@@ -84,9 +84,9 @@ describe('Button', () => {
expect(button).not.toBeInTheDocument();
});
- it('should render a button element if the `to` and `disabled` props are both defined', () => {
+ it('should render a button element if the `href` and `disabled` props are both defined', () => {
render(
-