Skip to content

Commit

Permalink
Merge branch 'Community_list/#92' into header/#98
Browse files Browse the repository at this point in the history
  • Loading branch information
Brokyeom committed Jul 19, 2022
2 parents 05063b7 + e8785b8 commit e9360fd
Show file tree
Hide file tree
Showing 15 changed files with 15,825 additions and 3,165 deletions.
8 changes: 6 additions & 2 deletions components/common/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export default function Header() {
</Link>
<StSearchWrapper>
<StSearchBar>
<input type="text" placeholder="상품명, 스토어명을 검색해보세요!" />
<input
type="text"
maxLength={60}
placeholder="상품명, 스토어명을 검색해보세요!"
/>
<IcSearchIcon />
</StSearchBar>
<StMenu>
Expand All @@ -43,7 +47,7 @@ const StHeaderWrapper = styled.header`
position: sticky;
top: -3.2rem;
width: 100%;
width: 192rem;
height: 11.4rem;
background-color: ${({ theme }) => theme.colors.mainGreen};
Expand Down
56 changes: 56 additions & 0 deletions components/common/ToyList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import styled from '@emotion/styled';
import keyframes from '@emotion/react';
import ToyPreview from './ToyPreview';

interface ToyListProps {
landingCategory: string;
length: number;
isViewProduct: boolean;
}

export default function ToyList(props: ToyListProps) {
const { landingCategory, length, isViewProduct } = props;
const toyList = new Array(length).fill(0);
return (
<StToyListWrapper>
{toyList.map((_, idx) =>
landingCategory === 'popularity' ? (
<StPopularityWrapper key={idx}>
<ToyPreview
isViewProduct={isViewProduct}
src="d"
store="그린키드"
title="[보행기대여] NEW 뉴 롤링360 플러스 다기능 아기보행기"
price={12000}
age="36개월이상"
/>
</StPopularityWrapper>
) : (
<ToyPreview
isViewProduct={isViewProduct}
key={idx}
src="d"
store="그린키드"
title="[보행기대여] NEW 뉴 롤링360 플러스 다기능 아기보행기"
price={12000}
age="36개월이상"
/>
),
)}
</StToyListWrapper>
);
}

const StToyListWrapper = styled.section`
display: flex;
justify-content: center;
align-items: center;
`;
const StPopularityWrapper = styled.article`
margin: 0rem 2.1rem;
transition: all 0.2s linear;
&:hover {
transform: scale(1.1);
}
`;
123 changes: 123 additions & 0 deletions components/common/ToyPreview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { useState } from 'react';
import { IcFillToyMark, IcToyMark } from '../../public/assets/icons';

interface ToyPreviewProps {
src: string;
store: string;
title: string;
price: number;
age: string;
isViewProduct: boolean;
}

export default function ToyPreview(props: ToyPreviewProps) {
const { src, store, title, price, age, isViewProduct } = props;
const [isMark, setIsMark] = useState(false);
const handleToyMark = () => {
setIsMark((prev) => !prev);
};
return (
<StToyWrapper isViewProduct={isViewProduct}>
<StImgWrapper>
<StToyImg
isViewProduct={isViewProduct}
src="https://www.littlebaby.co.kr:14019/shop/data/goods/1632018070797m0.jpg"
/>
<StToyMarkWrapper isViewProduct={isViewProduct} onClick={handleToyMark}>
<StToyMark />
{isMark && <StFillToyMark />}
</StToyMarkWrapper>
</StImgWrapper>
<StStore>{store}</StStore>
<StTitle>{title}</StTitle>
<StPrice>{price}</StPrice>
<StAge>{age}</StAge>
</StToyWrapper>
);
}

const StToyWrapper = styled.article<{ isViewProduct: boolean }>`
display: flex;
flex-direction: column;
margin: 0rem 1.25rem;
${({ isViewProduct }) =>
isViewProduct
? css`
margin: 0rem 1rem;
`
: css`
margin: 0rem 1.25rem;
`}
`;
const StImgWrapper = styled.div`
position: relative;
`;
const StToyImg = styled.img<{ isViewProduct: boolean }>`
width: 27.5rem;
height: 27.5rem;
border: 0.1rem solid #e2e2e2;
border-radius: 0.8rem;
`;
const StToyMarkWrapper = styled.div<{ isViewProduct: boolean }>`
position: absolute;
${({ isViewProduct }) =>
isViewProduct
? css`
top: 1.2rem;
left: 19rem;
`
: css`
top: 1.7rem;
left: 23.6rem;
`}
`;
const StToyMark = styled(IcToyMark)`
position: absolute;
top: 0;
left: 0;
`;
const StFillToyMark = styled(IcFillToyMark)`
position: absolute;
top: 0.2rem;
left: 0.2rem;
`;
const StStore = styled.div`
width: 22.4rem;
margin-top: 1.6rem;
font-weight: 500;
font-size: 1.4rem;
color: #a9a9a9;
`;
const StTitle = styled.div`
width: 22.4rem;
margin-top: 0.8rem;
font-weight: 400;
font-size: 1.6rem;
display: flex;
align-items: center;
color: #000000;
`;
const StPrice = styled.div`
width: 22.4rem;
margin-top: 1.3rem;
font-weight: 700;
font-size: 1.9rem;
:after {
content: '원';
}
`;
const StAge = styled.div`
width: fit-content;
padding: 0.3rem 1rem 0.4rem;
margin-top: 0.8rem;
background: #ffe766;
border-radius: 0.4rem;
font-weight: 600;
font-size: 1rem;
line-height: 141%;
`;
2 changes: 1 addition & 1 deletion components/common/WriteHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const StWriteHeaderWrapper = styled.section`
position: sticky;
top: -3.2em;
width: 100%;
width: 192rem;
height: 11.4rem;
padding-top: 4.2rem;
Expand Down
106 changes: 22 additions & 84 deletions components/community/CommunityList.tsx
Original file line number Diff line number Diff line change
@@ -1,50 +1,30 @@
import styled from '@emotion/styled';
// import { useState } from 'react';
import { IcCommunitySearchIcon } from '../../public/assets/icons';
import ContentCard from './ContentsCard';
import CommunityFloatingBtn from './CommunityFloatingBtn';
import { CommunityData } from '../../types/community';

export default function CommunityList() {
interface CommunityListProps {
contentsList: CommunityData[];
}

export default function CommunityList(props: CommunityListProps) {
const { contentsList } = props;
// const [category, setCategory] = useState<string>('모든 글');

return (
<StCommunityListWrapper>
<StSearchBar>
<input type="text" placeholder="궁금한 장난감 정보를 검색해보세요:)" />
<IcCommunitySearchIcon />
</StSearchBar>
<StMainArticle>
<StFloatingBlock />
<StContentCardList>
<ContentCard
category="후기"
title="3살 아가를 위한 쏘서 제품 추천!"
content="군인 또는 군무원이 아닌 국민은 대한민국의 영역안에서는 중대한 군사상 기밀·초병·초소·유독음식물공급·포로·군용물에 관한 죄중 법률이 정한 경우와 비상계엄이 선포된 경우를 제외하고는 군사법원의 재판을 받지 아니한다. 선거에 관한 경비는 법률이 정하는 경우....경우와 비상계엄이 선포된 경우를 제외하고는 군사법원의 재판을 받지 아니한다. 선거에 관한 경비는 법률이 정하는 경우...."
userNickname="예현맘"
createdAt="2022.07.12"
replyCount={12}
img="https://www.littlebaby.co.kr:14019/shop/data/goods/1632018070797m0.jpg"
/>
<ContentCard
category="정보공유"
title="역시 그린키드 미끄럼틀이 가성비 좋네요"
content="군인 또는 군무원이 아닌 국민은 대한민국의 영역안에서는 중대한 군사상 기밀·초병·초소·유독음식물공급·포로·군용물에 관한 죄중 법률이 정한 경우와 비상계엄이 선포된 경우를 제외하고는 군사법원의 재판을 받지 아니한다. 선거에 관한 경비는 법률이 정하는 경우....경우와 비상계엄이 선포된 경우를 제외하고는 군사법원의 재판을 받지 아니한다. 선거에 관한 경비는 법률이 정하는 경우...."
userNickname="예현맘"
createdAt="4분 전"
replyCount={127}
/>
<ContentCard
category="질문"
title="그린키드 미끄럼틀 아이가 좋아하네요"
content="군인 또는 군무원이 아닌 국민은 대한민국의 영역안에서는 중대한 군사상 기밀·초병·초소·유독음식물공급·포로·군용물에 관한 죄중 법률이 정한 경우와 비상계엄이 선포된 경우를 제외하고는 군사법원의 재판을 받지 아니한다. 선거에 관한 경비는 법률이 정하는 경우....경우와 비상계엄이 선포된 경우를 제외하고는 군사법원의 재판을 받지 아니한다. 선거에 관한 경비는 법률이 정하는 경우...."
userNickname="예현맘"
createdAt="2022.07.12"
replyCount={3}
img="https://www.littlebaby.co.kr:14019/shop/data/goods/1632018070797m0.jpg"
/>
</StContentCardList>
<CommunityFloatingBtn />
</StMainArticle>
{contentsList.map((content, idx) => (
<ContentCard
key={idx}
category={content.category}
title={content.title}
content={content.content}
userNickname={content.userNickname}
createdAt={content.createdAt}
replyCount={content.replyCount}
img={content.image}
/>
))}
</StCommunityListWrapper>
);
}
Expand All @@ -54,51 +34,9 @@ const StCommunityListWrapper = styled.section`
flex-direction: column;
justify-content: center;
align-items: center;
flex-wrap: wrap;
margin-bottom: 4.8rem;
`;
const StSearchBar = styled.div`
display: flex;
flex-direction: row;
width: 57.6rem;
height: 4.5rem;
border-bottom: 0.2rem solid ${({ theme }) => theme.colors.gray008};
margin-bottom: 7.9rem;
input {
margin-left: 0.9rem;
width: 60rem;
height: 3.3rem;
font-size: 2.5rem;
width: 97.6rem;
color: ${({ theme }) => theme.colors.gray006};
${({ theme }) => theme.fonts.b10_22_regular_150}
&::placeholder {
font-family: Pretandard;
color: ${({ theme }) => theme.colors.gray006};
${({ theme }) => theme.fonts.b10_22_regular_150}
}
:focus::placeholder {
opacity: 0;
}
}
& > svg {
margin-right: 0.9rem;
cursor: pointer;
}
`;
const StMainArticle = styled.article`
display: flex;
`;

const StFloatingBlock = styled.div`
width: 9rem;
margin-bottom: 4.8rem;
`;

const StContentCardList = styled.div``;
13 changes: 7 additions & 6 deletions components/community/ContentsCard.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import styled from '@emotion/styled';
import { useState } from 'react';
import { IcReply, IcHeart, IcDot } from '../../public/assets/icons';

interface ContentInfoProps {
category: string;
title: string;
content: string;
userNickname: string;
replyCount: number;
createdAt: string;
userNickname?: string;
replyCount?: number;
createdAt?: string;
img?: string;
}

Expand Down Expand Up @@ -109,6 +108,8 @@ const StContentImg = styled.img`
width: 21.6rem;
height: 21.6rem;
object-fit: cover;
border: 0.1rem solid ${({ theme }) => theme.colors.gray005};
border-radius: 0.5rem;
`;
Expand All @@ -119,14 +120,14 @@ const StWriteInfo = styled.div`
margin-bottom: 1.2rem;
span:first-child {
span:first-of-type {
margin-right: 1rem;
color: ${({ theme }) => theme.colors.gray008};
${({ theme }) => theme.fonts.b4_15_semibold_146}
}
span:last-child {
span:last-of-type {
margin-left: 1rem;
color: ${({ theme }) => theme.colors.gray008};
Expand Down
7 changes: 7 additions & 0 deletions core/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import axios from 'axios';
import useSWR from 'swr';
import { baseInstance } from './axios';

export const getData = (key: string) => {
return baseInstance.get(key);
};
Loading

0 comments on commit e9360fd

Please sign in to comment.