-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf96ee5
commit 7b975c8
Showing
3 changed files
with
108 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
Meta, | ||
Story, | ||
} from '@storybook/react/types-6-0'; | ||
import React from 'react'; | ||
import ExternalLink, { Props } from '../../../components/utils/ExternalLink'; | ||
import withChildrenMock from '../../shared/hocs/withChildrenMock'; | ||
|
||
type PropsWithChildrenMock = Props & { | ||
text?: string; | ||
}; | ||
|
||
export default { | ||
title: 'Next Right Now/Form/ExternalLink', | ||
component: ExternalLink, | ||
argTypes: withChildrenMock({}), | ||
} as Meta; | ||
|
||
const Template: Story<PropsWithChildrenMock> = (props) => { | ||
const { text } = props; | ||
|
||
return ( | ||
// @ts-ignore | ||
<ExternalLink | ||
{...props} | ||
onClick={(): void => console.info('Click')} | ||
> | ||
{text || 'Default text'} | ||
</ExternalLink> | ||
); | ||
}; | ||
|
||
export const DynamicExample: Story<PropsWithChildrenMock> = Template.bind({}); | ||
DynamicExample.args = { | ||
text: 'Open (another tab)', | ||
href: '/', | ||
nofollow: true, | ||
noopener: true, | ||
noreferrer: false, | ||
prefix: ' ', | ||
suffix: ' ', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { | ||
ButtonHTMLAttributes, | ||
DetailedHTMLProps, | ||
} from 'react'; | ||
|
||
/** | ||
* React HTML "Link" element properties. | ||
* Meant to be a helper when using custom buttons that should inherit native "<a>" properties. | ||
* | ||
* @example type MyLinkProps = { | ||
* href?: string; | ||
* } & ReactLinkProps; | ||
*/ | ||
export type ReactLinkProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>; |
7b975c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not what you expected? Are your scores flaky? Run Lighthouse on Foo
If scores continue to be inconsistent consider running all audits on Foo