-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(article): add create article feature
- add TextArea, TextAreaField, DropDown, DropDownField components - add editorJS - modify useForm - add create article page [Finishes #166272067]
- Loading branch information
1 parent
8ac47db
commit f3297e5
Showing
35 changed files
with
1,220 additions
and
75 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,73 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const DropDown = ({ | ||
list, | ||
name, | ||
label, | ||
onChange, | ||
value, | ||
}) => { | ||
return ( | ||
<DropDown.Container name={name} onChange={onChange}> | ||
<option value=''>{label}</option> | ||
{ | ||
list.length | ||
? list.map(item => <option | ||
value={item.id} | ||
key={item.id} | ||
defaultValue={item.id === value ? true : null} | ||
> | ||
{item.name} | ||
</option>) | ||
: null | ||
} | ||
</DropDown.Container> | ||
); | ||
}; | ||
|
||
DropDown.propTypes = { | ||
list: PropTypes.array.isRequired, | ||
name: PropTypes.string.isRequired, | ||
onChange: PropTypes.func.isRequired, | ||
value: PropTypes.string, | ||
label: PropTypes.string, | ||
}; | ||
|
||
DropDown.Container = styled.select` | ||
${({ | ||
padding, | ||
fontSize, | ||
color, | ||
theme, | ||
}) => ` | ||
color: ${theme.textColors[color]}; | ||
padding: ${theme.spacing[padding] || '0'}; | ||
font-size: ${theme.fontSizes[fontSize]}; | ||
width: 18rem; | ||
height: 4.0rem; | ||
display: block; | ||
font-size: 1.4rem; | ||
background: transparent; | ||
color: #B02091; | ||
border: 1px solid #B02091; | ||
box-sizing: border-box; | ||
@media ${theme.device.mobileS} { | ||
font-size: 1.2rem; | ||
} | ||
@media ${theme.device.mobileM} { | ||
font-size: 1.3rem; | ||
} | ||
@media ${theme.device.mobileL} { | ||
font-size: 1.3rem; | ||
} | ||
@media ${theme.device.tablet} { | ||
font-size: 1.3rem; | ||
} | ||
`} | ||
`; | ||
|
||
|
||
export default DropDown; |
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,25 @@ | ||
DropDown Default: | ||
|
||
```jsx | ||
const name = 'dropdown'; | ||
|
||
const onChange = () => true; | ||
|
||
const list = [ | ||
{ | ||
id: '07dea297-f951-4367-8da0-96462086d3e7', | ||
updatedAt: '2019-07-30 10:58:48.324+00', | ||
name: 'adventure', | ||
createdAt: '2019-07-30 10:58:48.324+00', | ||
}, | ||
{ | ||
id: '4df25c1f-4224-4c7b-9807-2711dd337897', | ||
updatedAt: '2019-07-30 10:58:48.323+00', | ||
name: 'defaults', | ||
createdAt: '2019-07-30 10:58:48.323+00', | ||
}, | ||
]; | ||
|
||
<DropDown list={list} name={name} onChange={onChange} label='category'/> | ||
|
||
``` |
Oops, something went wrong.