Skip to content

Commit

Permalink
feat: verification detail 페이지로 인하여 upload path 변경[meong-story#96]
Browse files Browse the repository at this point in the history
  • Loading branch information
j2h30728 committed Oct 22, 2024
1 parent d16c37d commit 3237589
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 26 deletions.
8 changes: 4 additions & 4 deletions src/pages/Home/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ const HomePage = () => {
<S.VerificationWrapper>
<VerificationButton
name={VERIFICATION.WALK}
navigatePath={`${ROUTE_PATH.VERIFICATION}/${VERIFICATION.WALK}`}
navigatePath={`${ROUTE_PATH.UPLOAD}/${VERIFICATION.WALK}`}
title="산책인증"
icon={<Walk />}
/>
<VerificationButton
name={VERIFICATION.MEAL}
navigatePath={`${ROUTE_PATH.VERIFICATION}/${VERIFICATION.MEAL}`}
navigatePath={`${ROUTE_PATH.UPLOAD}/${VERIFICATION.MEAL}`}
title="식사인증"
icon={<Meal />}
/>
<VerificationButton
name={VERIFICATION.TREATS}
navigatePath={`${ROUTE_PATH.VERIFICATION}/${VERIFICATION.TREATS}`}
navigatePath={`${ROUTE_PATH.UPLOAD}/${VERIFICATION.TREATS}`}
title="간식인증"
icon={<Treats />}
/>
<VerificationButton
name={VERIFICATION.BATH}
navigatePath={`${ROUTE_PATH.VERIFICATION}/${VERIFICATION.BATH}`}
navigatePath={`${ROUTE_PATH.UPLOAD}/${VERIFICATION.BATH}`}
title="목욕인증"
icon={<Bath />}
/>
Expand Down
3 changes: 2 additions & 1 deletion src/shared/constants/routePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const ROUTE_PATH = {
REGISTER_PET: '/register/pet',
REGISTER_PEOPLE: '/register/people',
VERIFICATION: '/verification',
UPLOAD_VERIFICATION: '/verification/:category',
UPLOAD: '/upload',
UPLOAD_VERIFICATION: '/upload/:category',
DETAIL_VERIFICATION: '/verification/:verificationId',
SLIDE: '/slide',
GRID: '/grid',
Expand Down
8 changes: 2 additions & 6 deletions src/shared/constants/verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ export const MEAL_OPTION = {
};

export const TREATS_OPTION = {
DOG_CHEW: '강아지껌',
DRIED_TREAT: '건조간식',
JERKY_TREAT: '저키/트릿',
CAN: '캔',
BISCUIT: '비스킷',
OTHER: '기타',
ALL: '다 먹었어요!',
NONE: '거의 안먹었어요!',
};

export const BATH_OPTION = {
Expand Down
3 changes: 0 additions & 3 deletions src/widgets/verification/ui/VerificationOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const VerificationOption = ({
case VERIFICATION.MEAL:
return (
<VerificationRadioOptions
name="meal"
options={Object.values(MEAL_OPTION)}
register={register}
watch={watch}
Expand All @@ -54,7 +53,6 @@ const VerificationOption = ({
case VERIFICATION.TREATS:
return (
<VerificationRadioOptions
name="treats"
options={Object.values(TREATS_OPTION)}
register={register}
watch={watch}
Expand All @@ -64,7 +62,6 @@ const VerificationOption = ({
case VERIFICATION.BATH:
return (
<VerificationRadioOptions
name="bath"
options={Object.values(BATH_OPTION)}
register={register}
watch={watch}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import styled from 'styled-components';

import { VerificationWithCategory } from './VerificationRadioOptions';

export const VerificationOptionContainer = styled.label<{
$name: VerificationWithCategory;
}>`
export const VerificationOptionContainer = styled.label`
display: flex;
width: ${({ $name }) => ($name === 'treats' ? 'auto' : '100%')};
margin: ${({ $name }) => ($name === 'treats' ? '0 -60px' : '')};
width: 100%;
justify-content: space-around;
align-items: center;
gap: 10px;
Expand Down
6 changes: 1 addition & 5 deletions src/widgets/verification/ui/VerificationRadioOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,21 @@ import { Fragment } from 'react/jsx-runtime';
import { verificationOption } from '../../../shared/constants/verification';
import * as S from './VerificationRadioOptions.styled';

export type VerificationWithCategory = 'meal' | 'treats' | 'bath';

const VerificationRadioOptions = ({
options,
register,
watch,
setValue,
name,
}: {
options: string[];
register: UseFormRegister<FieldValues>;
watch: UseFormWatch<FieldValues>;
setValue: UseFormSetValue<FieldValues>;
name: VerificationWithCategory;
}) => {
const currentValue = watch(verificationOption) as string;

return (
<S.VerificationOptionContainer $name={name}>
<S.VerificationOptionContainer>
{Object.values(options).map((value) => (
<Fragment key={value}>
<input
Expand Down

0 comments on commit 3237589

Please sign in to comment.