-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add components/Card, File, Select, Textarea, Typography
- Loading branch information
1 parent
764b6f3
commit 800caac
Showing
5 changed files
with
89 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export default function Card({ style, children, ...restProps }) { | ||
return ( | ||
<div {...restProps} style={style}> | ||
{children} | ||
</div> | ||
); | ||
} | ||
|
||
Card.propTypes = { | ||
style: PropTypes.object, | ||
children: PropTypes.element.isRequired, | ||
}; |
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,15 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import Input from '../Input'; | ||
|
||
export default function File({ name, accept, ...restProps }) { | ||
return ( | ||
<Input {...restProps} type="file" id={name} name={name} accept={accept} /> | ||
); | ||
} | ||
|
||
File.propTypes = { | ||
name: PropTypes.string, | ||
accept: PropTypes.string, | ||
}; |
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,23 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export default function Select({ name, options }) { | ||
return ( | ||
<select name={name} id={name}> | ||
{options.map(({ value, label }) => ( | ||
<option key={`${name}-${label}`} value={value}> | ||
{label} | ||
</option> | ||
))} | ||
</select> | ||
); | ||
} | ||
|
||
Select.propTypes = { | ||
name: PropTypes.string, | ||
options: PropTypes.array, | ||
}; | ||
|
||
Select.defaultProps = { | ||
options: [], | ||
}; |
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 React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export default function Textarea({ name, text, rows, cols, ...restProps }) { | ||
return ( | ||
<textarea {...restProps} id={name} name={name} rows={rows} cols={cols}> | ||
{text} | ||
</textarea> | ||
); | ||
} | ||
|
||
Textarea.propTypes = { | ||
name: PropTypes.string, | ||
text: PropTypes.string, | ||
rows: PropTypes.number, | ||
cols: PropTypes.number, | ||
}; | ||
|
||
Textarea.defaultProps = { | ||
checked: false, | ||
}; |
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,15 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export default function Typography({ type, text, ...restProps }) { | ||
return React.createElement(`${type}`, { ...restProps }, text); | ||
} | ||
|
||
Typography.propTypes = { | ||
type: PropTypes.string, | ||
text: PropTypes.string.isRequired, | ||
}; | ||
|
||
Typography.defaultProps = { | ||
type: 'div', | ||
}; |