-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/letter receive #9
base: develop
Are you sure you want to change the base?
Changes from all commits
e85bf3e
6518642
95cf33a
3fe885b
6e00980
18ae0d7
04e2289
91fa6ed
8966558
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import Text from '../Text/Text'; | ||
import { LetterDataType } from '../../constants/Letters'; | ||
|
||
export interface LetterProps extends Omit<LetterDataType, 'id'> { | ||
content: string; | ||
thumbnail: string; | ||
writer: string; | ||
} | ||
|
||
const Wrapper = styled.div``; | ||
|
||
const Writer = styled.div``; | ||
|
||
const Content = styled.div``; | ||
Comment on lines
+12
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아래로 내려주세여 |
||
|
||
const Letter: React.FC<LetterDataType> = ({ content, writer }) => { | ||
return ( | ||
<Wrapper> | ||
<Text> | ||
<Writer>{writer}</Writer> | ||
</Text> | ||
<Content>{content}</Content> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
export default Letter; |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,31 @@ | ||||||||||||||||
import React from 'react'; | ||||||||||||||||
import styled from 'styled-components'; | ||||||||||||||||
import { useHistory } from 'react-router-dom'; | ||||||||||||||||
import { LetterDataType } from '../../constants/Letters'; | ||||||||||||||||
import Text from '../Text/Text'; | ||||||||||||||||
|
||||||||||||||||
export interface LetterProps extends Omit<LetterDataType, 'content'> { | ||||||||||||||||
id: string; | ||||||||||||||||
thumbnail: string; | ||||||||||||||||
writer: string; | ||||||||||||||||
} | ||||||||||||||||
Comment on lines
+7
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
|
||||||||||||||||
const Wrapper = styled.div``; | ||||||||||||||||
|
||||||||||||||||
const Writer = styled.div``; | ||||||||||||||||
|
||||||||||||||||
const Thumbnail = styled.div``; | ||||||||||||||||
Comment on lines
+13
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 얘도 아래로우 |
||||||||||||||||
|
||||||||||||||||
const LetterThumbnail: React.FC<LetterProps> = ({ thumbnail, writer, id }) => { | ||||||||||||||||
const history = useHistory(); | ||||||||||||||||
return ( | ||||||||||||||||
<Wrapper onClick={() => history.push(`/letter-read/${id}`)}> | ||||||||||||||||
<Text> | ||||||||||||||||
<Writer>{writer}</Writer> | ||||||||||||||||
</Text> | ||||||||||||||||
Comment on lines
+23
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Writer를 styled 컴포넌트로 Text 감싸게 하면 될 둣 |
||||||||||||||||
<Thumbnail>{thumbnail}</Thumbnail> | ||||||||||||||||
</Wrapper> | ||||||||||||||||
); | ||||||||||||||||
}; | ||||||||||||||||
|
||||||||||||||||
export default LetterThumbnail; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import faker from 'faker'; | ||
|
||
export interface LetterDataType { | ||
id: string; | ||
content: string; | ||
thumbnail: string; | ||
writer: string; | ||
} | ||
|
||
export const emptyLetter: LetterDataType = { | ||
id: '', | ||
content: '', | ||
writer: '', | ||
thumbnail: '', | ||
}; | ||
Comment on lines
+10
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요거 필요없을 듯 |
||
|
||
export const letters: LetterDataType[] = [ | ||
{ | ||
content: faker.lorem.sentences(), | ||
id: faker.random.uuid(), | ||
thumbnail: faker.lorem.sentence(), | ||
writer: faker.name.firstName(), | ||
}, | ||
{ | ||
content: faker.lorem.sentences(), | ||
id: faker.random.uuid(), | ||
thumbnail: faker.lorem.sentence(), | ||
writer: faker.name.firstName(), | ||
}, | ||
{ | ||
content: faker.lorem.sentences(), | ||
id: faker.random.uuid(), | ||
thumbnail: faker.lorem.sentence(), | ||
writer: faker.name.firstName(), | ||
}, | ||
]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import { useHistory } from 'react-router-dom'; | ||
import styled from 'styled-components'; | ||
import Letter from '../components/Letter/Letter'; | ||
import { LetterDataType, letters, emptyLetter } from '../constants/Letters'; | ||
|
||
const Wrapper = styled.div``; | ||
|
||
const ExitButton = styled.button``; | ||
Comment on lines
+7
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아래로오 호우! |
||
|
||
const LetterReadPage: React.FC = () => { | ||
const history = useHistory(); | ||
const letterId = history.location.pathname.substring(13); | ||
const letterToRead: LetterDataType = | ||
letters.find((letter) => letter.id === letterId) || emptyLetter; | ||
Comment on lines
+10
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return ( | ||
<Wrapper> | ||
<Letter {...letterToRead} /> | ||
<ExitButton onClick={() => history.goBack()}>Return to mailbox</ExitButton> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
export default LetterReadPage; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import LetterThumbnail from '../components/Letter/LetterThumbnail'; | ||
import { letters } from '../constants/Letters'; | ||
const Wrapper = styled.div``; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아래로 메우! |
||
|
||
const LettersPage: React.FC = () => { | ||
return ( | ||
<Wrapper> | ||
{letters.map((letter) => { | ||
return <LetterThumbnail key={letter.id} {...letter} />; | ||
})} | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
export default LettersPage; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1798,6 +1798,11 @@ | |
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" | ||
integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== | ||
|
||
"@types/faker@^5.1.6": | ||
version "5.1.6" | ||
resolved "https://registry.yarnpkg.com/@types/faker/-/faker-5.1.6.tgz#f029aaebfc2d7931a3d729c0888c15f0187d2453" | ||
integrity sha512-D+gfFWR/YCvlrYL8lgNZO1jKgIUW+cfhxsgMOqUMYwCI+tl0htD7vCCXp/oJsIxJpxuI7zqmo3gpVQBkFCM4iA== | ||
|
||
"@types/glob@^7.1.1": | ||
version "7.1.3" | ||
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.3.tgz#e6ba80f36b7daad2c685acd9266382e68985c183" | ||
|
@@ -1908,12 +1913,12 @@ | |
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.4.tgz#15925414e0ad2cd765bfef58842f7e26a7accb24" | ||
integrity sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug== | ||
|
||
"@types/react-dom@^16.9.8": | ||
version "16.9.10" | ||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.9.10.tgz#4485b0bec3d41f856181b717f45fd7831101156f" | ||
integrity sha512-ItatOrnXDMAYpv6G8UCk2VhbYVTjZT9aorLtA/OzDN9XJ2GKcfam68jutoAcILdRjsRUO8qb7AmyObF77Q8QFw== | ||
"@types/react-dom@^17.0.0": | ||
version "17.0.0" | ||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.0.tgz#b3b691eb956c4b3401777ee67b900cb28415d95a" | ||
integrity sha512-lUqY7OlkF/RbNtD5nIq7ot8NquXrdFrjSOR6+w9a9RFQevGi1oZO1dcJbXMeONAPKtZ2UrZOEJ5UOCVsxbLk/g== | ||
dependencies: | ||
"@types/react" "^16" | ||
"@types/react" "*" | ||
|
||
"@types/react-router-dom@^5.1.7": | ||
version "5.1.7" | ||
|
@@ -1932,22 +1937,14 @@ | |
"@types/history" "*" | ||
"@types/react" "*" | ||
|
||
"@types/react@*": | ||
"@types/react@*", "@types/react@^17.0.0": | ||
version "17.0.0" | ||
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.0.tgz#5af3eb7fad2807092f0046a1302b7823e27919b8" | ||
integrity sha512-aj/L7RIMsRlWML3YB6KZiXB3fV2t41+5RBGYF8z+tAKU43Px8C3cYUZsDvf1/+Bm4FK21QWBrDutu8ZJ/70qOw== | ||
dependencies: | ||
"@types/prop-types" "*" | ||
csstype "^3.0.2" | ||
|
||
"@types/react@^16", "@types/react@^16.9.53": | ||
version "16.14.2" | ||
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.14.2.tgz#85dcc0947d0645349923c04ccef6018a1ab7538c" | ||
integrity sha512-BzzcAlyDxXl2nANlabtT4thtvbbnhee8hMmH/CcJrISDBVcJS1iOsP1f0OAgSdGE0MsY9tqcrb9YoZcOFv9dbQ== | ||
dependencies: | ||
"@types/prop-types" "*" | ||
csstype "^3.0.2" | ||
|
||
"@types/[email protected]": | ||
version "0.0.8" | ||
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" | ||
|
@@ -5211,6 +5208,11 @@ extsprintf@^1.2.0: | |
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" | ||
integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= | ||
|
||
faker@^5.3.1: | ||
version "5.3.1" | ||
resolved "https://registry.yarnpkg.com/faker/-/faker-5.3.1.tgz#67f8f5c170b97a76b875389e0e8b9155da7b4853" | ||
integrity sha512-sVdoApX/awJHO9DZHZsHVaJBNFiJW0n3lPs0q/nFxp/Mtya1dr2sCMktST3mdxNMHjkvKTTMAW488E+jH1eSbg== | ||
|
||
fast-deep-equal@^3.1.1: | ||
version "3.1.3" | ||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.