Skip to content

Commit

Permalink
[FEAT] 분양후기 퍼블리싱 작업
Browse files Browse the repository at this point in the history
  • Loading branch information
granen32 authored and granen32 committed Sep 9, 2023
1 parent 144e52d commit 52b93c9
Show file tree
Hide file tree
Showing 15 changed files with 1,496 additions and 75 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react-query": "^1.2.9",
"@types/ua-parser-js": "^0.7.37",
"add": "^2.0.6",
"axios": "^1.4.0",
"framer-motion": "^10.15.1",
Expand All @@ -30,7 +31,9 @@
"react-test-renderer": "^18.2.0",
"styled-components": "^6.0.7",
"styled-reset": "^4.5.1",
"toast": "^0.5.4",
"typescript": "^5.1.6",
"user-agent-parser": "^0.6.0",
"web-vitals": "^2.1.0",
"yarn": "^1.22.19"
},
Expand Down
Binary file added src/assets/images/reviews/dog_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/common/search/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const Input = styled.input`
border-radius: 1rem;
padding: 1rem 1.75rem;
min-width: 20rem;
height: 48px;
box-sizing: border-box;
border: none;
transition: outline 0.2s ease-in-out;
&::placeholder {
Expand Down
28 changes: 24 additions & 4 deletions src/components/common/select/OptionsSelected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface SelectOptionProps {
optionStyle?: React.CSSProperties;
selectedOptionStyle?: React.CSSProperties;
placeholder: string | undefined;
size: 'lg' | 'md' | 'sm';
}
const CustomSelect = styled.div`
position: relative;
Expand Down Expand Up @@ -45,10 +46,10 @@ const StyledOption = styled.option<{ isSelected: boolean }>`
font-weight: ${(props) => (props.isSelected ? 'bold' : 'normal')};
`;

const SelectOption: React.FC<SelectOptionProps> = ({ selectedValue, onSelect, options, placeholder }) => {
const SelectOption: React.FC<SelectOptionProps> = ({ selectedValue, onSelect, options, placeholder, size }) => {
const containerRef = useRef<HTMLDivElement>(null);
return (
<Container ref={containerRef}>
<Container ref={containerRef} size={size}>
<CustomSelect>
<Select placeholder={placeholder}>
{options.map((option) => (
Expand All @@ -74,10 +75,29 @@ const SelectOption: React.FC<SelectOptionProps> = ({ selectedValue, onSelect, op
};

export default SelectOption;
const Container = styled.div`
const Container = styled.div<{ size: string }>`
display: flex;
flex-direction: column;
position: relative;
width: 100%;
margin-bottom: 1rem;
gap: 1.25rem;
margin-right: 15px;
${(props) => {
switch (props.size) {
case 'lg':
return `
max-width:280px
`;
case 'md':
return `
max-width:240px
`;
case 'sm':
return `
max-width:160px
`;
default:
return '';
}
}}
`;
6 changes: 5 additions & 1 deletion src/components/mypage/sidemenuItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export const adoptmenuItem: ISidemenuItem[] = [
},
{
name: '분양후기 관리',
path: PATHS.mypage.reviews,
path: PATHS.mypage.reviews.root,
},
{
name: '분양후기 관리 글쓰기',
path: PATHS.mypage.reviews.edit,
},
{
name: '프로필 관리',
Expand Down
5 changes: 4 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ export const PATHS = {
/**분양 신청 내역 */
adopt: '/mypage/adopt',
/**분양 후기 관리 */
reviews: '/mypage/reviews',
reviews: {
root: '/mypage/reviews',
edit: '/mypage/reviews/edit/:id',
},
/** 보유견종 관리 */
breed: {
/** 보유견종 관리 루트 */
Expand Down
4 changes: 3 additions & 1 deletion src/layout/MypageForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ export default function MypageForm({ children }: IMypageForm) {

const Container = styled.div`
width: 100%;
padding: 5.5rem 2.2rem 3rem 2.2rem;
padding: 80px 2.2rem 3rem 2.2rem;
background-color: #ffffff;
border-radius: 1.5rem;
margin-bottom: 1.5rem;
box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 15px;
min-height: 928px;
box-sizing: border-box;
`;
12 changes: 10 additions & 2 deletions src/layout/MypageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const ContainerWrap = styled.div`
display: flex;
flex-direction: row;
top: 17.75rem;
width: 85%;
min-width: 1280px;
height: 100%;
`;

Expand Down Expand Up @@ -136,6 +136,12 @@ const LabelWrap = styled.h4`
font-style: normal;
font-weight: 500;
line-height: 2.25rem;
margin-bottom: 40px;
position: relative;
display: flex;
width: 100%;
align-items: center;
justify-content: space-between;
`;

MypageLayout.Header = styled.div`
Expand All @@ -144,8 +150,10 @@ MypageLayout.Header = styled.div`
`;
MypageLayout.ContentsHeaders = styled.div`
display: flex;
justify-content: space-between;
justify-content: flex-end;
align-items: center;
margin-bottom: 20px;
position: relative;
`;

MypageLayout.Content = styled.div``;
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import UserDetail from './user/[id]';
import Dogs from './dogs';
import Reviews from './mypage/breeders/reviews/reviews';
import Reserve from './reserve';
import ReviewWriting from './mypage/breeders/reviews/reviewWriting';

export default function Router() {
const { isLoggedIn } = useLogin();
Expand Down Expand Up @@ -83,7 +84,8 @@ export default function Router() {
<Route path="*" element={<div>404</div>} />

<Route path={PATHS.mypage.adopt} element={<Adopt />} />
<Route path={PATHS.mypage.reviews} element={<Reviews />} />
<Route path={PATHS.mypage.reviews.root} element={<Reviews />} />
<Route path={PATHS.mypage.reviews.edit} element={<ReviewWriting />} />
<Route path={PATHS.mypage.breed.root} element={<Breed />} />
<Route path={PATHS.mypage.breed.new} element={<NewBreed />} />
<Route path={PATHS.mypage.breed.edit} element={<EditBreed />} />
Expand Down
1 change: 1 addition & 0 deletions src/pages/mypage/breeders/reviews/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default as Reviews } from './reviews';
export { default as ReviewWriting } from './reviewWriting';
142 changes: 142 additions & 0 deletions src/pages/mypage/breeders/reviews/reviewWriting.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import MypageLayout from 'layout/MypageLayout';
import MypageForm from 'layout/MypageForm';
import * as S from './style';
import { useState } from 'react';
import Button, { ButtonColor, ButtonSize } from 'components/common/button/Button';
const ReviewWriting = () => {
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
};
const defaultFileName = '이미지 파일을 업로드 해주세요';
const [files, setFile] = useState<File>();
const [imgSrc, setImgSrc] = useState<string | undefined>();
const [fileName, setFileName] = useState<string>(defaultFileName);
const [percent, setPercent] = useState(0);
const imageSelectdHandler = (evnet: React.ChangeEvent<HTMLInputElement>) => {
const target = evnet.currentTarget;
const files = (target.files as FileList)[0];
if (files === undefined) {
return;
}
setFile(files);
setFileName(files.name);
const fileReader = new FileReader();
fileReader.readAsDataURL(files);
fileReader.onload = (event: any) => setImgSrc(event.target?.result);
};
const onSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
const formData = new FormData();
};
return (
<MypageLayout>
<S.ReviewBox>
<S.ReviewContentsBox>
<MypageForm>
<MypageLayout.Label>
분양후기 관리
<S.PreviewBtn>
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="none">
<rect x="0.5" y="0.5" width="47" height="47" rx="7.5" fill="white" stroke="#AEAEAE" />
<path
d="M29 14L18 24L29 34"
stroke="#AEAEAE"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
<div>이전 페이지로</div>
</S.PreviewBtn>
</MypageLayout.Label>
<S.FormContainer onSubmit={handleSubmit}>
<S.EditBox>
<S.SemiTitle>분양 후기 글쓰기</S.SemiTitle>
<S.EditContetsBox>
<div className="line">
<div className="box">
<S.Label>제목</S.Label>
<S.Input placeholder="제목을 작성하세요" />
</div>
<div className="box">
<S.Label>견종</S.Label>
<S.Input placeholder="포메라니안" />
</div>
</div>
<div className="line">
<div className="box">
<S.Label>성별</S.Label>
<S.Input placeholder="수컷" />
</div>
<div className="box">
<S.Label>강아지 이름</S.Label>
<S.Input placeholder="루카스" />
</div>
</div>
</S.EditContetsBox>
<S.ReviewWritingBox>
<S.EditContetsBox>
<div className="box">
<S.Label>분양 후기 작성</S.Label>
<S.StyledTextarea placeholder="분양후기를 작성해주세요" />
</div>
</S.EditContetsBox>
</S.ReviewWritingBox>
</S.EditBox>
</S.FormContainer>
<S.ImageUploadBox>
<div className="box">
<S.Label>이미지 업로드 (0/4)</S.Label>
</div>
<form action="" onSubmit={onSubmit}>
<S.ImagesSeleted>
<div className="sumnail_icon">
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 13 13" fill="none">
<rect x="5.13965" width="2.72093" height="13" rx="1.36047" fill="#AEAEAE" />
<rect
x="13"
y="5.14062"
width="2.72093"
height="13"
rx="1.36047"
transform="rotate(90 13 5.14062)"
fill="#AEAEAE"
/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="45" viewBox="0 0 50 45" fill="none">
<g clip-path="url(#clip0_1336_4937)">
<path
d="M49.8708 6.44556L46.6409 36.7826C46.5117 39.0579 45.0905 39.3107 42.7649 38.9315V36.4034L43.9277 36.6562L47.1577 6.19275L12.6615 2.65342L12.2739 6.95117L9.43156 7.07758L9.94836 2.40061C10.0776 0.883757 11.4987 -0.127479 12.9199 -0.00107408L47.4161 3.53825C48.9664 3.66466 50.1292 5.05511 49.8708 6.44556ZM40.1809 9.73207L41.6021 40.7012C41.7313 42.218 40.5685 43.4821 39.0181 43.4821L4.26361 44.9989C2.71322 45.1253 1.42123 43.9877 1.42123 42.4708L4.04222e-05 11.5017C-0.129159 9.98488 1.03363 8.72084 2.58402 8.72084L37.3385 7.20398C38.7597 7.07758 40.0517 8.21522 40.1809 9.73207ZM4.13441 41.9652L38.8889 40.4484L37.4677 9.85848L2.71322 11.3753L4.13441 41.9652ZM37.0801 31.3472C37.0801 30.4624 36.6925 29.4512 36.0465 28.8192L33.5918 26.2911C32.6874 25.5326 31.3954 25.5326 30.6202 26.4175L26.2274 31.4736L16.6667 19.9708C15.8915 18.9596 14.3411 18.9596 13.4367 19.9708L5.94319 29.5776C5.4264 30.336 5.0388 31.2208 5.168 32.2321L5.5556 40.8276L37.4677 39.1843L37.0801 31.3472ZM31.5246 20.7293C33.5918 20.6029 35.1422 18.9596 35.1422 16.9371C35.013 14.9147 33.3334 13.3978 31.2662 13.3978C29.199 13.5242 27.6486 15.1675 27.6486 17.1899C27.6486 19.3388 29.4574 20.8557 31.5246 20.7293Z"
fill="#AEAEAE"
/>
</g>
<defs>
<clipPath id="clip0_1336_4937">
<rect width="50" height="45" fill="white" />
</clipPath>
</defs>
</svg>
</div>

<label htmlFor="image">{fileName}</label>
<input type="file" id="image" multiple accept="image/*" onChange={imageSelectdHandler} />
</S.ImagesSeleted>
<Button buttonSize={ButtonSize.MEDIUM} style={{ fontSize: 18 }}>
업로드
</Button>
</form>
</S.ImageUploadBox>
</MypageForm>
</S.ReviewContentsBox>
</S.ReviewBox>
<S.ButtonWrap>
<Button buttonSize={ButtonSize.MEDIUM}>저장</Button>
<Button buttonSize={ButtonSize.MEDIUM} buttonColor={ButtonColor.BLACK}>
삭제
</Button>
</S.ButtonWrap>
</MypageLayout>
);
};

export default ReviewWriting;
Loading

0 comments on commit 52b93c9

Please sign in to comment.