Skip to content

Commit

Permalink
refactor: 필요없는 부분 제거
Browse files Browse the repository at this point in the history
ref #37
  • Loading branch information
ppark2ya committed Feb 8, 2022
1 parent 29e6adf commit 58bb7e2
Showing 1 changed file with 6 additions and 82 deletions.
88 changes: 6 additions & 82 deletions pages/writing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,10 @@ const initialWriting: WritingContentsType = {
};

const Writing: NextPage = function () {
const folderList = [
{ value: 0, folder: '내 생각' },
{ value: 1, folder: 'option 1' },
{ value: 2, folder: 'option 2' },
{ value: 3, folder: 'option 3' },
];
const imageList = [0, 1, 2, 3];

const [data, setData] = useState<WritingContentsType>(initialWriting);

const mutation = usePostContents(data);

const onFolderChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
const { value } = e.target;
setData((prev) => ({ ...prev, folder: parseInt(value) }));
};

const onTitleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const { value } = e.target;
setData({ ...data, title: value });
Expand Down Expand Up @@ -69,18 +56,6 @@ const Writing: NextPage = function () {
<Box>
<Table.Wrapper>
<tbody>
<Table.TableRow>
<Table.TitleTd>{'폴더'}</Table.TitleTd>
<Table.ContentsTd>
<select value={data.folder} onChange={onFolderChange}>
{folderList.map((item, index) => (
<option value={item.value} key={index}>
{item.folder}
</option>
))}
</select>
</Table.ContentsTd>
</Table.TableRow>
<Table.TableRow>
<Table.TitleTd>{'제목'}</Table.TitleTd>
<Table.ContentsTd>
Expand All @@ -91,12 +66,6 @@ const Writing: NextPage = function () {
/>
</Table.ContentsTd>
</Table.TableRow>
<Table.TableRow>
<Table.TitleTd css={{ height: '360px' }}>{'내용'}</Table.TitleTd>
<Table.ContentsTd css={{ height: '360px' }}>
<TextEditor value={data.contents} onChange={onContentsChange} />
</Table.ContentsTd>
</Table.TableRow>
<Table.TableRow>
<Table.TitleTd>{'글 소개'}</Table.TitleTd>
<Table.ContentsTd>
Expand All @@ -115,51 +84,15 @@ const Writing: NextPage = function () {
/>
</Table.ContentsTd>
</Table.TableRow>
<Table.TableRow>
<Table.TitleTd css={{ height: '360px' }}>{'내용'}</Table.TitleTd>
<Table.ContentsTd css={{ height: '360px' }}>
<TextEditor value={data.contents} onChange={onContentsChange} />
</Table.ContentsTd>
</Table.TableRow>
</tbody>
</Table.Wrapper>
</Box>
<hr />
<Box css={{ display: 'flex' }}>
<Button css={{ margin: 'auto', border: '1px solid #C4C7CA' }}>
{'책으로 쓰기'}
</Button>
</Box>
<Box css={{ display: 'flex' }}>
<Box css={{ margin: '0 10px 0' }}>
<label>{'분류'}</label>
<select>
<option>{'짧은글'}</option>
</select>
</Box>
<Box css={{ margin: '0 10px 0' }}>
<label>{'언어'}</label>
<select>
<option>{'한국어'}</option>
</select>
</Box>
<Box css={{ margin: '0 10px 0' }}>
<label>{'연재'}</label>
<select>
<option>{'시리즈'}</option>
</select>
</Box>
<Box css={{ margin: '0 10px 0' }}>
<label>{'시리즈명'}</label>
<select>
<option>{'가끔 그 시절의 내가 그립다.'}</option>
</select>
</Box>
</Box>
<hr />
<Box css={{ display: 'flex' }}>
<Box css={{ display: 'flex', margin: 'auto' }}>
{imageList.map((item) => (
<Box css={{ margin: '0 10px 0' }} key={`img-${item}`}>
<img width={'230'} height={'210'} />
</Box>
))}
</Box>
</Box>
<Box css={{ display: 'flex' }}>
<Box css={{ margin: 'auto' }}>
<Button css={{ border: '1px solid #C4C7CA', margin: '0 5px 0' }}>
Expand All @@ -175,15 +108,6 @@ const Writing: NextPage = function () {
>
{'등록완료'}
</Button>
<Button
css={{
color: '$primary',
border: '1px solid $primary',
margin: '0 5px 0',
}}
>
{'임시저장'}
</Button>
</Box>
</Box>
</Box>
Expand Down

0 comments on commit 58bb7e2

Please sign in to comment.