-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: 모두의 정원 등록 페이지 #362
feat: 모두의 정원 등록 페이지 #362
Changes from 33 commits
a9c718b
19613f8
264e5b8
44d1a0f
c455b71
1937578
ba8ebcc
18f321e
8817587
0d9c5fe
3e5b9f2
d6610a1
83d7f2e
5cb5386
f88cde2
789a767
443ee23
5fb1695
fa66ab6
a64dc75
edf25e6
7a9e487
fdcb427
8bccf2f
5ed132a
8bb6014
d06855a
3466ee2
56d645c
3fad939
4a2cfbe
4eef772
c2427c9
de773c3
06e14b9
7605a8e
45bd549
5a95f25
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,23 @@ | ||
import type { GardenRegisterForm } from 'types/garden'; | ||
import { BASE_URL } from 'constants/index'; | ||
|
||
export const GARDEN_URL = `${BASE_URL}/garden`; | ||
|
||
const headers = { | ||
'Content-Type': 'application/json', | ||
}; | ||
|
||
const register = (form: GardenRegisterForm) => { | ||
return fetch(GARDEN_URL, { | ||
method: 'POST', | ||
headers, | ||
credentials: 'include', | ||
body: JSON.stringify(form), | ||
}); | ||
}; | ||
|
||
const GardenAPI = { | ||
register, | ||
}; | ||
|
||
export default GardenAPI; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { styled } from 'styled-components'; | ||
|
||
export const Padding = styled.span` | ||
padding: 3px 13px; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,10 @@ import { | |
EnvironmentItem, | ||
TimelineLinkArea, | ||
TimelineLink, | ||
EditLink, | ||
DeleteButton, | ||
PrimaryLink, | ||
ButtonArea, | ||
TertiaryButton, | ||
TertiaryLink, | ||
} from './PetPlantDetail.style'; | ||
import useDeletePetPlant from 'hooks/queries/petPlant/useDeletePetPlant'; | ||
import usePetPlantDetails from 'hooks/queries/petPlant/usePetPlantDetails'; | ||
|
@@ -37,16 +39,16 @@ interface PetDetailsProps { | |
|
||
const PetPlantDetail = ({ petPlantId }: PetDetailsProps) => { | ||
const { data: petPlantDetails } = usePetPlantDetails(petPlantId); | ||
const { mutate: deleteMutate } = useDeletePetPlant(); | ||
const confirm = useConfirm(); | ||
const { mutate } = useDeletePetPlant(); | ||
|
||
if (!petPlantDetails) return null; | ||
|
||
const { | ||
id, | ||
imageUrl, | ||
nickname, | ||
dictionaryPlant: { id: dictId, name: dictName }, | ||
dictionaryPlant: { id: dictionaryPlantId, name: dictionaryPlantName }, | ||
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. 👍 |
||
birthDate, | ||
daySince, | ||
waterCycle, | ||
|
@@ -66,7 +68,7 @@ const PetPlantDetail = ({ petPlantId }: PetDetailsProps) => { | |
|
||
if (!isConfirmed) return; | ||
|
||
mutate(id); | ||
deleteMutate(petPlantId); | ||
}; | ||
|
||
const birthDateKorean = convertDateKorYear(birthDate); | ||
|
@@ -79,16 +81,16 @@ const PetPlantDetail = ({ petPlantId }: PetDetailsProps) => { | |
|
||
return ( | ||
<Wrapper> | ||
<Image type="wide" src={imageUrl} alt={`${nickname}(${dictName})`} size="300px" /> | ||
<Image type="wide" src={imageUrl} alt={`${nickname}(${dictionaryPlantName})`} size="300px" /> | ||
<Content> | ||
<TitleArea> | ||
<Title> | ||
{nickname} | ||
{isBirthday && <SvgFill icon="crown" aria-hidden="true" />} | ||
</Title> | ||
<StyledLink to={generatePath(URL_PATH.dictDetail, { id: dictId.toString() })}> | ||
<StyledLink to={generatePath(URL_PATH.dictDetail, { id: dictionaryPlantId.toString() })}> | ||
<SubTitle> | ||
{dictName} | ||
{dictionaryPlantName} | ||
<SvgStroke icon="dictionary" aria-hidden="true" color={theme.color.grayDark} /> | ||
</SubTitle> | ||
</StyledLink> | ||
|
@@ -179,14 +181,20 @@ const PetPlantDetail = ({ petPlantId }: PetDetailsProps) => { | |
{wind} | ||
</EnvironmentItem> | ||
</Environment> | ||
<ExpandedTextBox> | ||
<EditLink to={generatePath(URL_PATH.petEdit, { id: petPlantId.toString() })}> | ||
<ButtonArea> | ||
<TertiaryLink to={generatePath(URL_PATH.petEdit, { id: petPlantId.toString() })}> | ||
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. hover하면 붉은 색이어서 한번 확인해주세요~ |
||
정보 수정하기 | ||
</EditLink> | ||
<DeleteButton type="button" onClick={deletePetPlant}> | ||
식물 삭제하기 | ||
</DeleteButton> | ||
</ExpandedTextBox> | ||
</TertiaryLink> | ||
<TertiaryButton type="button" onClick={deletePetPlant}> | ||
삭제하기 | ||
</TertiaryButton> | ||
</ButtonArea> | ||
<PrimaryLink | ||
to={generatePath(URL_PATH.gardenRegisterForm, { id: petPlantId.toString() })} | ||
state={{ nickname, dictionaryPlantName, imageUrl }} | ||
> | ||
모두의 정원에 등록하기 | ||
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. 기록하기 반영 해주시나요? 😃 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. 앗 하나만 하고 나머지를 안했네요ㅋㅋㅋㅋ 👀 |
||
</PrimaryLink> | ||
</Content> | ||
</Wrapper> | ||
); | ||
|
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.
👍