File tree 4 files changed +14
-17
lines changed 4 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 1
- import React from 'react' ;
2
1
import { render } from '@testing-library/react' ;
3
2
4
- import Anchor from './Anchor' ;
3
+ import { Anchor } from './Anchor' ;
5
4
6
5
const defaultProps = {
7
6
children : '' ,
Original file line number Diff line number Diff line change 1
- import React from 'react' ;
1
+ import { ComponentMeta } from '@storybook/ react' ;
2
2
import styled from 'styled-components' ;
3
3
4
- import { Anchor } from 'react95 ' ;
4
+ import { Anchor } from './Anchor ' ;
5
5
6
6
const Wrapper = styled . div `
7
7
padding: 5rem;
@@ -12,7 +12,7 @@ export default {
12
12
title : 'Anchor' ,
13
13
component : Anchor ,
14
14
decorators : [ story => < Wrapper > { story ( ) } </ Wrapper > ]
15
- } ;
15
+ } as ComponentMeta < typeof Anchor > ;
16
16
17
17
export function Default ( ) {
18
18
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' ;
3
2
4
3
import styled from 'styled-components' ;
5
4
@@ -12,20 +11,19 @@ const StyledAnchor = styled.a`
12
11
}
13
12
` ;
14
13
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
+ }
17
17
18
+ const Anchor = forwardRef < HTMLAnchorElement , AnchorProps > ( function Anchor (
19
+ { children, ...otherProps } : AnchorProps ,
20
+ ref
21
+ ) {
18
22
return (
19
23
< StyledAnchor ref = { ref } { ...otherProps } >
20
24
{ children }
21
25
</ StyledAnchor >
22
26
) ;
23
27
} ) ;
24
28
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';
3
3
export { createScrollbars } from './common/index' ;
4
4
5
5
/* components */
6
- export { default as Anchor } from './Anchor/Anchor' ;
6
+ export * from './Anchor/Anchor' ;
7
7
export { default as AppBar } from './AppBar/AppBar' ;
8
8
export { default as Avatar } from './Avatar/Avatar' ;
9
9
export { default as Bar } from './Bar/Bar' ;
You can’t perform that action at this time.
0 commit comments