Skip to content

Commit 7ef196a

Browse files
author
Nikolai Lopin
committed
docs: migrate Link docs to csf3
1 parent aa0312e commit 7ef196a

File tree

3 files changed

+120
-103
lines changed

3 files changed

+120
-103
lines changed

src/components/Link/docs/Link.stories.mdx

Lines changed: 0 additions & 103 deletions
This file was deleted.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import { StoryObj, Meta } from '@storybook/react';
2+
3+
import { onDarkBackground } from '../../../docs/parameters';
4+
import { Link } from '../Link';
5+
6+
const meta: Meta = {
7+
title: 'Components/Link',
8+
component: Link,
9+
argTypes: {
10+
children: {
11+
description: 'Content of the link',
12+
table: {
13+
type: {
14+
summary: 'ReactNode'
15+
}
16+
}
17+
},
18+
fontSize: {
19+
options: [0, 1, 2, 3, 4],
20+
defaultValue: 2,
21+
control: 'select',
22+
description: 'Font size of the link',
23+
table: {
24+
type: {
25+
summary: 'number | string'
26+
}
27+
}
28+
},
29+
target: {
30+
description:
31+
'Target of the link, see [MDN article](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes)',
32+
table: {
33+
type: {
34+
summary: '_self | _blank | _parent | _top'
35+
}
36+
}
37+
},
38+
href: {
39+
description:
40+
'Href of the link, see [MDN article](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes)',
41+
table: {
42+
type: {
43+
summary: 'string'
44+
}
45+
}
46+
},
47+
as: {
48+
description: 'What html-tag to use',
49+
table: {
50+
defaultValue: {
51+
summary: 'a'
52+
},
53+
type: {
54+
summary: 'string | ReactComponent'
55+
}
56+
}
57+
},
58+
ref: {
59+
description: 'Reference to the DOM element'
60+
},
61+
theme: {
62+
table: {
63+
disable: true
64+
}
65+
},
66+
forwardedAs: {
67+
table: {
68+
disable: true
69+
}
70+
}
71+
},
72+
args: {
73+
href: 'https://free-now.com/',
74+
target: '_blank',
75+
children: 'Go to FreeNow website'
76+
}
77+
};
78+
79+
export default meta;
80+
81+
type Story = StoryObj<typeof Link>;
82+
83+
export const Default: Story = {};
84+
85+
export const WithManualFontSize: Story = {
86+
args: {
87+
fontSize: 1
88+
}
89+
};
90+
91+
export const Inverted: Story = {
92+
args: {
93+
inverted: true
94+
},
95+
parameters: {
96+
...onDarkBackground
97+
}
98+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Primary, Stories, ArgTypes, Meta } from '@storybook/blocks';
2+
import { StyledSystemLinks } from '../../../docs/StyledSystemLinks';
3+
import * as LinkStories from './Link.stories';
4+
5+
<Meta of={LinkStories} />
6+
7+
# Link
8+
9+
The Link component styles anchor tags with default blue styling and hover text decoration. Link is used for destinations, or moving from one page to another.
10+
11+
- Use links to navigate on and between pages and flows
12+
- For interactions consider Buttons
13+
14+
<Primary />
15+
16+
## Properties
17+
18+
<ArgTypes of={LinkStories} />
19+
20+
<StyledSystemLinks component="Link" supportedProps={['margin', 'fontSize', 'textAlign']} />
21+
22+
<Stories includePrimary={false} />

0 commit comments

Comments
 (0)