-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
15 changed files
with
15,825 additions
and
3,165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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%; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
Oops, something went wrong.