Skip to content

Commit

Permalink
feat(article): add create article feature
Browse files Browse the repository at this point in the history
- add TextArea, TextAreaField, DropDown, DropDownField components
- add editorJS
- modify useForm
- add create article page

[Finishes #166272067]
  • Loading branch information
frankly034 committed Aug 2, 2019
1 parent 8ac47db commit f3297e5
Show file tree
Hide file tree
Showing 35 changed files with 1,220 additions and 75 deletions.
116 changes: 86 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@
"@babel/preset-env": "^7.3.4",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.3.4",
"@editorjs/code": "^2.4.1",
"@editorjs/delimiter": "^1.1.0",
"@editorjs/editorjs": "^2.15.0",
"@editorjs/embed": "^2.2.1",
"@editorjs/header": "^2.3.0",
"@editorjs/image": "^2.3.1",
"@editorjs/inline-code": "^1.3.0",
"@editorjs/list": "^1.4.0",
"@editorjs/marker": "^1.2.1",
"@editorjs/paragraph": "^2.6.0",
"@editorjs/raw": "^2.1.1",
"@testing-library/jest-dom": "^4.0.0",
"@testing-library/react": "^8.0.5",
"@testing-library/react-hooks": "^1.1.0",
Expand Down
73 changes: 73 additions & 0 deletions src/components/UI/atoms/DropDown/DropDown.jsx
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;
25 changes: 25 additions & 0 deletions src/components/UI/atoms/DropDown/DropDown.md
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'/>

```
Loading

0 comments on commit f3297e5

Please sign in to comment.