Skip to content

Commit

Permalink
feat: 데이터 구조화
Browse files Browse the repository at this point in the history
  • Loading branch information
wonjin-dev committed Jan 14, 2024
1 parent 74f822d commit 48a31f5
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pages/write/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import WriteInput from '@components/Input/WriteInput';
import WriteGuide from '@domain/Write/components/Guide';
import WriteHistory from '@domain/Write/History';
import { useInput } from '@hooks/useInput';

import * as style from './style.css';
Expand All @@ -10,6 +11,7 @@ const WritePage = () => {
return (
<div className={style.container}>
<WriteGuide />
<WriteHistory data={[]} />
<WriteInput inputProps={writeInput} />
</div>
);
Expand Down
5 changes: 5 additions & 0 deletions pages/write/style.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { style } from '@vanilla-extract/css';

export const container = style({
margin: '0 120px',
});
12 changes: 12 additions & 0 deletions src/domain/Write/History/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { type Write } from '@domain/Write/types';

const WriteHistoryCard = ({ createAt, value }: Omit<Write, 'id'>) => {
return (
<li>
<p>{createAt}</p>
<p>{value}</p>
</li>
);
};

export default WriteHistoryCard;
5 changes: 5 additions & 0 deletions src/domain/Write/History/index.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { style } from '@vanilla-extract/css';

export const container = style({
marginBottom: '48px',
});
29 changes: 29 additions & 0 deletions src/domain/Write/History/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { type WriteHisotry } from '../types';
import WriteHistoryCard from './components/Card';
import * as style from './index.css';

interface WriteHistoryProps {
data: WriteHisotry[];
}

const WriteHistory = ({ data }: WriteHistoryProps) => {
return (
<section className={style.container}>
{data.map((history) => (
<ol key={history.date}>
<p>{history.date}</p>

{history.histroy.map((history) => (
<WriteHistoryCard
key={history.id}
createAt={history.createAt}
value={history.value}
/>
))}
</ol>
))}
</section>
);
};

export default WriteHistory;
1 change: 1 addition & 0 deletions src/domain/Write/components/guide.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { style } from '@vanilla-extract/css';
import { COLORS } from '@styles/tokens';

export const guideText = style({
marginTop: '148px',
marginBottom: '12px',
color: COLORS['Grey/500'],
textAlign: 'center',
Expand Down
10 changes: 10 additions & 0 deletions src/domain/Write/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface Write {
id: string;
createAt: string;
value: string;
}

export interface WriteHisotry {
date: string;
histroy: Write[];
}

0 comments on commit 48a31f5

Please sign in to comment.