Skip to content

Commit e1097c9

Browse files
committed
Add back link buttons stories using basic button
1 parent 3cd8648 commit e1097c9

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

src/Button/Button.stories.tsx

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {EyeClosedIcon, EyeIcon, SearchIcon, TriangleDownIcon, XIcon} from '@primer/octicons-react'
1+
import {EyeClosedIcon, EyeIcon, SearchIcon, TriangleDownIcon, XIcon, TriangleRightIcon} from '@primer/octicons-react'
22
import {Meta} from '@storybook/react'
3-
import React, {useState} from 'react'
3+
import React, {useState, forwardRef} from 'react'
44
import {Button, ButtonProps, IconButton} from '.'
55
import {BaseStyles, ThemeProvider} from '..'
66
import Box from '../Box'
@@ -199,52 +199,52 @@ export const DisabledButton = ({...args}: ButtonProps) => {
199199
)
200200
}
201201

202-
// type ReactRouterLikeLinkProps = {to: string; children: React.ReactNode}
203-
// const ReactRouterLikeLink = forwardRef<HTMLAnchorElement, ReactRouterLikeLinkProps>(
204-
// ({to, ...props}: {to: string; children: React.ReactNode}, ref) => {
205-
// // eslint-disable-next-line jsx-a11y/anchor-has-content
206-
// return <a ref={ref} href={to} {...props} />
207-
// }
208-
// )
202+
type ReactRouterLikeLinkProps = {to: string; children: React.ReactNode}
203+
const ReactRouterLikeLink = forwardRef<HTMLAnchorElement, ReactRouterLikeLinkProps>(
204+
({to, ...props}: {to: string; children: React.ReactNode}, ref) => {
205+
// eslint-disable-next-line jsx-a11y/anchor-has-content
206+
return <a ref={ref} href={to} {...props} />
207+
}
208+
)
209209

210-
// export const linkButton = ({...args}: ButtonProps) => {
211-
// return (
212-
// <>
213-
// <Box mb={2} display="flex">
214-
// <LinkButton href="https://primer.style/" {...args}>
215-
// Link to Primer
216-
// </LinkButton>
217-
// </Box>
218-
// <Box mb={2} display="flex">
219-
// <LinkButton href="https://primer.style/" variant="danger" {...args}>
220-
// Link to Primer
221-
// </LinkButton>
222-
// </Box>
223-
// <Box mb={2} display="flex">
224-
// <LinkButton href="https://primer.style/" variant="primary" {...args}>
225-
// Link to Primer
226-
// </LinkButton>
227-
// </Box>
228-
// <Box mb={2} display="flex">
229-
// <LinkButton href="https://primer.style/" variant="outline" {...args}>
230-
// Link to Primer
231-
// </LinkButton>
232-
// </Box>
233-
// <Box mb={2} display="flex">
234-
// <LinkButton href="https://primer.style/" variant="invisible" {...args}>
235-
// Link to Primer
236-
// </LinkButton>
237-
// </Box>
238-
// <Box mb={2} display="flex">
239-
// <LinkButton href="https://primer.style/" variant="primary" trailingIcon={TriangleRightIcon} {...args}>
240-
// Link to Primer
241-
// </LinkButton>
242-
// </Box>
243-
// <Box mb={2} display="flex">
244-
// <LinkButton to="/dummy" as={ReactRouterLikeLink} variant="primary" trailingIcon={TriangleRightIcon} {...args}>
245-
// Link to Primer
246-
// </LinkButton>
247-
// </Box>
248-
// </>
249-
// )
250-
// }
210+
export const linkButton = ({...args}: ButtonProps) => {
211+
return (
212+
<>
213+
<Box mb={2} display="flex">
214+
<Button as="a" href="https://primer.style/" {...args}>
215+
Link to Primer
216+
</Button>
217+
</Box>
218+
<Box mb={2} display="flex">
219+
<Button as="a" href="https://primer.style/" variant="danger" {...args}>
220+
Link to Primer
221+
</Button>
222+
</Box>
223+
<Box mb={2} display="flex">
224+
<Button as="a" href="https://primer.style/" variant="primary" {...args}>
225+
Link to Primer
226+
</Button>
227+
</Box>
228+
<Box mb={2} display="flex">
229+
<Button as="a" href="https://primer.style/" variant="outline" {...args}>
230+
Link to Primer
231+
</Button>
232+
</Box>
233+
<Box mb={2} display="flex">
234+
<Button as="a" href="https://primer.style/" variant="invisible" {...args}>
235+
Link to Primer
236+
</Button>
237+
</Box>
238+
<Box mb={2} display="flex">
239+
<Button as="a" href="https://primer.style/" variant="primary" trailingIcon={TriangleRightIcon} {...args}>
240+
Link to Primer
241+
</Button>
242+
</Box>
243+
<Box mb={2} display="flex">
244+
<Button to="/dummy" as={ReactRouterLikeLink} variant="primary" trailingIcon={TriangleRightIcon} {...args}>
245+
Link to Primer
246+
</Button>
247+
</Box>
248+
</>
249+
)
250+
}

0 commit comments

Comments
 (0)