-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use symbol type when there's no baseconstraint (#23)
- Loading branch information
Showing
5 changed files
with
95 additions
and
4 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,21 @@ | ||
import * as React from 'react'; | ||
|
||
export interface BaseProps { | ||
value?: unknown; | ||
} | ||
|
||
export interface StandardProps extends BaseProps { | ||
variant?: 'standard'; | ||
} | ||
|
||
export interface OutlinedProps extends BaseProps { | ||
variant: 'outlined'; | ||
} | ||
|
||
export interface FilledProps extends BaseProps { | ||
variant: 'filled'; | ||
} | ||
|
||
export type TextFieldProps = StandardProps | OutlinedProps | FilledProps; | ||
|
||
export default function TextField(props: TextFieldProps): JSX.Element; |
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,11 @@ | ||
import * as React from 'react'; | ||
|
||
export default function TextField(props) { | ||
const { value, variant } = props; | ||
|
||
return ( | ||
<React.Fragment> | ||
{variant}: <input value={value} /> | ||
</React.Fragment> | ||
); | ||
} |
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,19 @@ | ||
import * as React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
function TextField(props) { | ||
const { value, variant } = props; | ||
|
||
return ( | ||
<React.Fragment> | ||
{variant}: <input value={value} /> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
TextField.propTypes = { | ||
value: PropTypes.any, | ||
variant: PropTypes.oneOf(['filled', 'outlined', 'standard']), | ||
}; | ||
|
||
export default TextField; |
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,34 @@ | ||
{ | ||
"type": "ProgramNode", | ||
"body": [ | ||
{ | ||
"type": "ComponentNode", | ||
"name": "TextField", | ||
"types": [ | ||
{ | ||
"type": "PropTypeNode", | ||
"name": "variant", | ||
"propType": { | ||
"type": "UnionNode", | ||
"types": [ | ||
{ "type": "UndefinedNode" }, | ||
{ "type": "LiteralNode", "value": "\"standard\"" }, | ||
{ "type": "LiteralNode", "value": "\"outlined\"" }, | ||
{ "type": "LiteralNode", "value": "\"filled\"" } | ||
] | ||
}, | ||
"filenames": {} | ||
}, | ||
{ | ||
"type": "PropTypeNode", | ||
"name": "value", | ||
"propType": { | ||
"type": "UnionNode", | ||
"types": [{ "type": "UndefinedNode" }, { "type": "AnyNode" }] | ||
}, | ||
"filenames": {} | ||
} | ||
] | ||
} | ||
] | ||
} |