File tree Expand file tree Collapse file tree 4 files changed +14
-17
lines changed Expand file tree Collapse file tree 4 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 1- import React from 'react' ;
21import { render } from '@testing-library/react' ;
32
4- import Anchor from './Anchor' ;
3+ import { Anchor } from './Anchor' ;
54
65const defaultProps = {
76 children : '' ,
Original file line number Diff line number Diff line change 1- import React from 'react' ;
1+ import { ComponentMeta } from '@storybook/ react' ;
22import styled from 'styled-components' ;
33
4- import { Anchor } from 'react95 ' ;
4+ import { Anchor } from './Anchor ' ;
55
66const Wrapper = styled . div `
77 padding: 5rem;
@@ -12,7 +12,7 @@ export default {
1212 title : 'Anchor' ,
1313 component : Anchor ,
1414 decorators : [ story => < Wrapper > { story ( ) } </ Wrapper > ]
15- } ;
15+ } as ComponentMeta < typeof Anchor > ;
1616
1717export function Default ( ) {
1818 return (
Original file line number Diff line number Diff line change 1- import React from 'react' ;
2- import propTypes from 'prop-types' ;
1+ import React , { forwardRef } from 'react' ;
32
43import styled from 'styled-components' ;
54
@@ -12,20 +11,19 @@ const StyledAnchor = styled.a`
1211 }
1312` ;
1413
15- const Anchor = React . forwardRef ( function Anchor ( props , ref ) {
16- const { children, ...otherProps } = props ;
14+ interface AnchorProps extends React . AnchorHTMLAttributes < HTMLAnchorElement > {
15+ children : React . ReactNode ;
16+ }
1717
18+ const Anchor = forwardRef < HTMLAnchorElement , AnchorProps > ( function Anchor (
19+ { children, ...otherProps } : AnchorProps ,
20+ ref
21+ ) {
1822 return (
1923 < StyledAnchor ref = { ref } { ...otherProps } >
2024 { children }
2125 </ StyledAnchor >
2226 ) ;
2327} ) ;
2428
25- Anchor . defaultProps = { } ;
26-
27- Anchor . propTypes = {
28- children : propTypes . node . isRequired
29- } ;
30-
31- export default Anchor ;
29+ export { Anchor , AnchorProps } ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ export { default as styleReset } from './common/styleReset';
33export { createScrollbars } from './common/index' ;
44
55/* components */
6- export { default as Anchor } from './Anchor/Anchor' ;
6+ export * from './Anchor/Anchor' ;
77export { default as AppBar } from './AppBar/AppBar' ;
88export { default as Avatar } from './Avatar/Avatar' ;
99export { default as Bar } from './Bar/Bar' ;
You can’t perform that action at this time.
0 commit comments