|
1 | | -import {EyeClosedIcon, EyeIcon, SearchIcon, TriangleDownIcon, XIcon} from '@primer/octicons-react' |
| 1 | +import {EyeClosedIcon, EyeIcon, SearchIcon, TriangleDownIcon, XIcon, TriangleRightIcon} from '@primer/octicons-react' |
2 | 2 | import {Meta} from '@storybook/react' |
3 | | -import React, {useState} from 'react' |
| 3 | +import React, {useState, forwardRef} from 'react' |
4 | 4 | import {Button, ButtonProps, IconButton} from '.' |
5 | 5 | import {BaseStyles, ThemeProvider} from '..' |
6 | 6 | import Box from '../Box' |
@@ -199,52 +199,52 @@ export const DisabledButton = ({...args}: ButtonProps) => { |
199 | 199 | ) |
200 | 200 | } |
201 | 201 |
|
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 | +) |
209 | 209 |
|
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