-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #397 from softeerbootcamp-2nd/feat/ui-bug
[FEAT] #392: 상세 UI 수정
- Loading branch information
Showing
107 changed files
with
193 additions
and
71 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
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
File renamed without changes.
112 changes: 112 additions & 0 deletions
112
frontend/src/components/common/navbar/CarSelectContainer.tsx
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,112 @@ | ||
import { styled } from 'styled-components'; | ||
import CenterWrapper from '../layout/CenterWrapper'; | ||
import { useFetch } from '../../../hooks/useFetch'; | ||
import { CAR_LIST_API, IMG_URL } from '../../../utils/apis'; | ||
import { useState } from 'react'; | ||
import { flexCenterCss } from '../../../utils/commonStyle'; | ||
import { BodyKrMedium3, BodyKrMedium4 } from '../../../styles/typefaces'; | ||
import DefaultCardStyle from '../card/DefaultCardStyle'; | ||
import { DimmedBackground } from '../../modal/DimmedBackground'; | ||
|
||
interface ICar { | ||
carTypeId: number; | ||
carTypeImage: string; | ||
carTypeName: string; | ||
} | ||
|
||
interface ICarSelectContainer { | ||
visible: boolean; | ||
} | ||
|
||
export default function CarSelectContainer({ visible }: ICarSelectContainer) { | ||
const { data } = useFetch<ICar[]>(CAR_LIST_API); | ||
const [active, setActive] = useState(3); // 3: SUV | ||
const categoryList = ['수소/전기차', 'N', '승용', 'SUV', 'MVP', '소형트럭/택시', '트럭', '버스']; | ||
|
||
const handleCategoryClick = (idx: number) => { | ||
setActive(idx); | ||
}; | ||
const isActive = (idx: number) => idx === active; | ||
|
||
const categoryItemComponents = categoryList?.map((category, idx) => { | ||
return ( | ||
<CategoryItem $active={isActive(idx)} onClick={() => handleCategoryClick(idx)} key={idx}> | ||
<CategoryName>{category}</CategoryName> | ||
</CategoryItem> | ||
); | ||
}); | ||
|
||
const carItemComponents = data?.map((car, idx) => ( | ||
<CarItem key={idx}> | ||
<CarImg src={IMG_URL + car.carTypeImage} /> | ||
<CarName>{car.carTypeName}</CarName> | ||
</CarItem> | ||
)); | ||
|
||
return ( | ||
<> | ||
<Wrapper $visible={visible}> | ||
<CetnerWrapper> | ||
<CategoryWrapper>{categoryItemComponents}</CategoryWrapper> | ||
<CarListWrapper>{carItemComponents}</CarListWrapper> | ||
</CetnerWrapper> | ||
</Wrapper> | ||
<CarSelectDimmedBackground $displayDimmed={visible} /> | ||
</> | ||
); | ||
} | ||
|
||
const Wrapper = styled.div<{ $visible: boolean }>` | ||
display: ${({ $visible }) => ($visible ? 'block' : 'none')}; | ||
position: fixed; | ||
top: 60px; | ||
z-index: 99999999; | ||
height: 220px; | ||
width: 100%; | ||
background-color: ${({ theme }) => theme.color.white}; | ||
`; | ||
|
||
const CetnerWrapper = styled(CenterWrapper)``; | ||
const CategoryWrapper = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
margin-top: 16px; | ||
width: 100%; | ||
height: 38px; | ||
background-color: ${({ theme }) => theme.color.gray200}; | ||
`; | ||
|
||
const CategoryItem = styled.div<{ $active: boolean }>` | ||
${flexCenterCss} | ||
height: 100%; | ||
width: 100%; | ||
${BodyKrMedium4} | ||
color: ${({ $active, theme }) => ($active ? theme.color.white : theme.color.primaryColor)}; | ||
background-color: ${({ $active, theme }) => $active && theme.color.primaryColor}; | ||
cursor: pointer; | ||
`; | ||
const CategoryName = styled.span``; | ||
|
||
const CarListWrapper = styled.div` | ||
display: flex; | ||
margin-top: 20px; | ||
overflow: scroll; | ||
gap: 8px; | ||
`; | ||
const CarItem = styled(DefaultCardStyle)` | ||
${flexCenterCss} | ||
flex-direction: column; | ||
padding: 5px 8px; | ||
border: 1px solid transparent; | ||
`; | ||
const CarImg = styled.img` | ||
width: 160px; | ||
`; | ||
const CarName = styled.div` | ||
margin-top: 10px; | ||
${BodyKrMedium3} | ||
`; | ||
const CarSelectDimmedBackground = styled(DimmedBackground)` | ||
z-index: 10000000; | ||
`; |
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
2 changes: 1 addition & 1 deletion
2
frontend/src/containers/InnerColorPage/InnerColorFooterContainer.tsx
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
2 changes: 1 addition & 1 deletion
2
frontend/src/containers/InnerColorPage/InnerColorSelectContainer.tsx
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
Oops, something went wrong.