Skip to content

Commit

Permalink
๐ŸŽจ Publish(#83): css ์ƒ์†์œผ๋กœ ๋ณ€๊ฒฝ, Item ์ปดํฌ๋„ŒํŠธ ์ƒ์„ฑ
Browse files Browse the repository at this point in the history
  • Loading branch information
rhehfl committed Dec 8, 2024
1 parent 64ee2c0 commit 89335fa
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 52 deletions.
49 changes: 35 additions & 14 deletions src/features/store/styles.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
import Item from '@type/Item';
import styled, { css } from 'styled-components';

export const StoreItemWrapper = styled.div<{ $category: Item['category'] }>`
export const ItemContainer = styled.ul<{ $category: Item['category'] }>`
margin: 18px 0 27px 0;
display: grid;
grid-template-columns: repeat(4, 144px);
grid-template-rows: repeat(2, 125px);
gap: 21px 19px;
color: #a5ecf0;
font-size: 15px;
font-style: normal;
font-weight: 700;
line-height: 24px;
${({ $category }) =>
$category === 'profile' &&
css`
grid-template-columns: repeat(3, 180px);
grid-template-rows: repeat(1, 217px);
`}
`;
export const StoreItem = styled.div`

export const StoreItem = styled.li`
display: flex;
flex-direction: column;
align-items: center;
border-radius: 8px;
border: 2px solid #a5ecf0;
background: #f4f4f4;
padding: 10px 0;
color: #fff;
font-size: 10px;
font-style: normal;
font-weight: 700;
line-height: 16px;
letter-spacing: 0.2px;
cursor: pointer;
&:hover {
border-radius: 8px;
Expand All @@ -34,6 +46,7 @@ export const StoreItem = styled.div`
}
}
`;

export const ItemLabel = styled.label`
text-align: center;
display: block;
Expand All @@ -42,13 +55,10 @@ export const ItemLabel = styled.label`
border-radius: 15px;
border: 2px solid #a5ecf0;
background: #00d9e9;
color: #fff;
font-size: 10px;
font-style: normal;
font-weight: 700;
line-height: 16px; /* 160% */
letter-spacing: 0.2px;
color: inherit;
font: inherit;
`;

export const ItemImage = styled.img<{ $category: Item['category'] }>`
width: 125px;
height: 70px;
Expand All @@ -59,32 +69,43 @@ export const ItemImage = styled.img<{ $category: Item['category'] }>`
height: 160px;
`}
`;

export const PaginationDiv = styled.div`
width: 276px;
display: flex;
gap: 57px;
`;
export const PaginationButton = styled.button<{ $isSelect: boolean }>`
border: 0;
background-color: transparent;
color: #a5ecf0;
font-size: 15px;
font-style: normal;
font-weight: 700;
line-height: 24px; /* 160% */
`;

export const PaginationButton = styled.button<{ $isSelect: boolean }>`
border: 0;
background-color: transparent;
color: inherit;
font: inherit;
${({ $isSelect }) =>
$isSelect &&
css`
color: #00d9e9;
`}
`;
export const StoreCartListWrapper = styled.div`

export const StoreCartListWrapper = styled.ul`
display: flex;
overflow-y: auto;
margin: 26px 0 0 0;
flex-direction: column;
gap: 28px;
padding-right: 8px;
color: #a5ecf0;
font-size: 15px;
font-style: normal;
font-weight: 700;
line-height: 24px;
&::-webkit-scrollbar {
padding-left: 5px;
width: 8px;
Expand Down Expand Up @@ -115,5 +136,5 @@ export const PlaceLabel = styled.label`
font-size: 14px;
font-style: normal;
font-weight: 700;
line-height: 24px; /* 171.429% */
line-height: 24px;
`;
13 changes: 3 additions & 10 deletions src/features/store/ui/CartList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getImageUrl } from '@utils/getImageUrl';
import * as S from '../styles';
import Item from '@type/Item';
import type Item from '@type/Item';
import StoreItem from './StoreItem';
const testItem: Item[] = [
{
id: 1,
Expand Down Expand Up @@ -37,14 +37,7 @@ export default function CartList() {
<>
<S.StoreCartListWrapper>
{testItem.map(item => (
<S.StoreItem key={item.id}>
<S.ItemLabel>{item.name}</S.ItemLabel>
<S.ItemImage
$category={item.category}
src={getImageUrl(item.image)}
/>
<S.ItemLabel>{item.cost} Point</S.ItemLabel>
</S.StoreItem>
<StoreItem {...item} />
))}
</S.StoreCartListWrapper>
<S.PlaceLabel>์ด 1500ํฌ์ธํŠธ</S.PlaceLabel>
Expand Down
17 changes: 5 additions & 12 deletions src/features/store/ui/ItemContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getImageUrl } from '@/utils/getImageUrl';
import * as S from '../styles';
import { useState } from 'react';
import Item from '@type/Item';
import type Item from '@type/Item';
import StoreItem from './StoreItem';
const testItem: Item[] = [
{
id: 1,
Expand Down Expand Up @@ -41,18 +41,11 @@ export default function ItemContainer({ query }: ItemContainerProps) {
const [currentPage, setCurrentPage] = useState<number>();
return (
<>
<S.StoreItemWrapper $category={query}>
<S.ItemContainer $category={query}>
{testItem.map(item => (
<S.StoreItem key={item.id}>
<S.ItemLabel>{item.name}</S.ItemLabel>
<S.ItemImage
$category={item.category}
src={getImageUrl(item.image)}
/>
<S.ItemLabel>{item.cost} Point</S.ItemLabel>
</S.StoreItem>
<StoreItem {...item} />
))}
</S.StoreItemWrapper>
</S.ItemContainer>
{/* ์ถ”ํ›„ ํ•˜๋“œ์ฝ”๋”ฉ ์ˆ˜์ • */}
<S.PaginationDiv>
{[1, 2, 3, 4, 5].map(page => (
Expand Down
15 changes: 15 additions & 0 deletions src/features/store/ui/StoreItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type Item from '@type/Item';
import * as S from '../styles';
import { getImageUrl } from '@utils/getImageUrl';

export default function StoreItem({ id, name, image, category, cost }: Item) {
return (
<>
<S.StoreItem key={id}>
<S.ItemLabel>{name}</S.ItemLabel>
<S.ItemImage $category={category} src={getImageUrl(image)} />
<S.ItemLabel>{cost} Point</S.ItemLabel>
</S.StoreItem>
</>
);
}
2 changes: 1 addition & 1 deletion src/pages/store/Store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function Store() {
<globalS.RightSection>
<Header />
<S.CartListWrapper>
<S.Label>์žฅ๋ฐ”๊ตฌ๋‹ˆ</S.Label>
<S.CartLabel>์žฅ๋ฐ”๊ตฌ๋‹ˆ</S.CartLabel>
<CartList />
</S.CartListWrapper>
</globalS.RightSection>
Expand Down
37 changes: 22 additions & 15 deletions src/pages/store/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ export const CartListWrapper = styled.section`
background: #fff;
box-shadow: 0 3px #e5e5e5;
margin: 84px 47px 0 0;
color: #fff;
font-size: 10px;
font-style: normal;
font-weight: 700;
line-height: 16px;
letter-spacing: 0.2px;
`;
export const Label = styled.label`
export const CartLabel = styled.label`
margin: 18px 0 0 0;
display: block;
width: 147.003px;
Expand All @@ -37,7 +43,11 @@ export const MyCharacterSection = styled.section`
gap: 119px;
box-shadow: 0 3px #e5e5e5;
padding: 12px 0 0 24px;
color: #fff;
font-size: 12px;
font-weight: 700;
line-height: 20px;
text-transform: lowercase;
> div:nth-child(1) {
display: flex;
flex-direction: column;
Expand All @@ -64,27 +74,28 @@ export const FilterListContainer = styled.div`
align-items: center;
justify-content: flex-end;
padding: 18px 40px 19px 0;
font-size: 12px;
font-weight: 700;
line-height: 20px;
color: #ff4949;
text-transform: lowercase;
`;
export const FilterButton = styled.button<{ $isSelect: boolean }>`
width: 79px;
height: 23px;
border-radius: 15px;
border: 2px solid #ff4949;
background: #f4f4f4;
color: #ff4949;
font-size: 12px;
font-style: normal;
font-weight: 700;
line-height: 20px; /* 166.667% */
text-transform: lowercase;
font: inherit;
color: inherit;
${({ $isSelect }) =>
$isSelect &&
css`
color: #fff;
border-radius: 15px;
border: 2px solid #e8080c;
background: #ff4949;
`}
`};
`;
export const RedLine = styled.hr`
width: 632px;
Expand All @@ -98,10 +109,6 @@ export const Button = styled.button`
border-radius: 15px;
border: 2px solid #e8080c;
background: #ff4949;
color: #fff;
font-size: 12px;
font-style: normal;
font-weight: 700;
line-height: 20px; /* 166.667% */
text-transform: lowercase;
color: inherit;
font: inherit;
`;

0 comments on commit 89335fa

Please sign in to comment.