Skip to content

Commit

Permalink
Merge pull request #397 from softeerbootcamp-2nd/feat/ui-bug
Browse files Browse the repository at this point in the history
[FEAT] #392: 상세 UI 수정
  • Loading branch information
jijiseong authored Aug 22, 2023
2 parents d43f9c6 + 81932f7 commit 78a2584
Show file tree
Hide file tree
Showing 107 changed files with 193 additions and 71 deletions.
4 changes: 2 additions & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/images/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>내 차 만들기 - A2 Cartag</title>
</head>
<body>
<div id="root"></div>
Expand Down
Binary file removed frontend/public/images/car.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img0.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img1.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img10.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img11.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img12.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img13.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img14.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img15.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img16.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img17.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img18.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img19.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img2.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img20.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img21.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img22.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img23.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img24.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img25.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img26.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img27.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img28.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img29.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img3.png
Binary file not shown.
Binary file removed frontend/public/images/car360/img30.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img31.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img32.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img33.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img34.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img35.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img36.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img37.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img38.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img39.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img4.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img40.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img41.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img42.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img43.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img44.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img45.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img46.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img47.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img48.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img49.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img5.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img50.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img51.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img52.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img53.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img54.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img55.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img56.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img57.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img58.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img59.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img6.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img7.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img8.png
Diff not rendered.
Binary file removed frontend/public/images/car360/img9.png
Diff not rendered.
Diff not rendered.
Binary file removed frontend/public/images/extra_option/2_cooling 1.png
Diff not rendered.
Diff not rendered.
Binary file removed frontend/public/images/extra_option/pca.png
Diff not rendered.
Binary file removed frontend/public/images/extra_option/roa.png
Diff not rendered.
Binary file removed frontend/public/images/inner_car.png
Diff not rendered.
Binary file removed frontend/public/images/inner_color1.png
Diff not rendered.
Binary file removed frontend/public/images/inner_color2.png
Diff not rendered.
Binary file removed frontend/public/images/model_engine.png
Diff not rendered.
Binary file removed frontend/public/images/result1.png
Diff not rendered.
Binary file removed frontend/public/images/result2.png
Diff not rendered.
Binary file removed frontend/public/images/result3.png
Diff not rendered.
Binary file removed frontend/public/images/result4.png
Diff not rendered.
Binary file removed frontend/public/images/result5.png
Diff not rendered.
Binary file removed frontend/public/images/result6.png
Diff not rendered.
Binary file removed frontend/public/images/result7.png
Diff not rendered.
Binary file removed frontend/public/images/similar_quote/similar1.png
Diff not rendered.
Binary file removed frontend/public/images/wheel.png
Diff not rendered.
1 change: 0 additions & 1 deletion frontend/public/vite.svg
Diff not rendered.
7 changes: 1 addition & 6 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BrowserRouter } from 'react-router-dom';
import NavBar from './components/layout/NavBar';
import NavBar from './components/common/navbar/NavBar';
import Providers from './components/contextProviders/Providers';
import PriceStaticBar from './components/priceStaticBar/PriceStaticBar';
import CustomRouter from './components/router/CustomRouter';
Expand All @@ -8,16 +8,11 @@ import CloseModalProvider from './context/CloseModalProvider';
import SimilarQuoteModalProvider from './context/SimilarQuoteModalProvider';
import GuideModalProvider from './context/GuideModalProvider';
import ItemProvider from './context/ItemProvider';
import { useEffect } from 'react';
import QuoteSummaryModalProvider from './context/QuoteSummaryModalProvider';
import ShareModalProvider from './context/ShareModalProvider';
import ProgressProvider from './context/ProgressProvider';

function App() {
useEffect(() => {
localStorage.clear();
}, []);

const globalProviders = [
CloseModalProvider,
SimilarQuoteModalProvider,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/cardSlider/CardSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { styled, useTheme } from 'styled-components';
import { BodyKrRegular3, HeadingKrMedium6 } from '../../styles/typefaces';
import CenterWrapper from '../../components/layout/CenterWrapper';
import CenterWrapper from '../common/layout/CenterWrapper';
import { ArrowLeft, ArrowRight } from '../../components/common/icons/Icons';
import { ReactNode, useState } from 'react';
import Loading from '../loading/Loading';
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/components/cards/ModelTypeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ import { HTMLAttributes } from 'react';

interface IModelTypeCard extends HTMLAttributes<HTMLDivElement> {
active?: boolean;
desc: string;
percentage: number;
title: string;
price: number;
}

export default function ModelTypeCard({
active = false,
desc,
percentage,
title,
price,
...props
}: IModelTypeCard) {
return (
<Wrapper active={active} {...props}>
<ModelTypeDesc>{desc}</ModelTypeDesc>
<ModelTypeDesc>
<BlueText $active={active}>{percentage}%</BlueText>의 선택
</ModelTypeDesc>
<ModelTypeTitle>{title}</ModelTypeTitle>
<ModelTypePrice>
+{price.toLocaleString()}<CheckIcon active={active} />
Expand All @@ -46,3 +48,6 @@ const ModelTypePrice = styled.div`
const ModelTypeDesc = styled.div`
${BodyKrRegular4}
`;
const BlueText = styled.span<{ $active: boolean }>`
color: ${({ theme, $active }) => $active && theme.color.activeBlue2};
`;
2 changes: 1 addition & 1 deletion frontend/src/components/common/banner/Banner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { styled } from 'styled-components';
import { BodyKrRegular3, HeadingKrBold1 } from '../../../styles/typefaces';
import CenterWrapper from '../../layout/CenterWrapper';
import CenterWrapper from '../layout/CenterWrapper';

interface IBanner extends React.HTMLAttributes<HTMLDivElement> {
subtitle?: string;
Expand Down
112 changes: 112 additions & 0 deletions frontend/src/components/common/navbar/CarSelectContainer.tsx
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;
`;
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { useContext } from 'react';
import React, { useContext, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { css, styled, useTheme } from 'styled-components';
import { BodyKrMedium3, BodyKrRegular3, HeadingKrMedium6 } from '../../styles/typefaces';
import { ArrowDown, CancelIcon } from '../common/icons/Icons';
import { BodyKrMedium3, BodyKrRegular3, HeadingKrMedium6 } from '../../../styles/typefaces';
import { ArrowDown, CancelIcon } from '../icons/Icons';
import hyundaiLogo from '/images/logo.svg';
import { MESSAGE, PATH } from '../../utils/constants';
import { CloseModalContext } from '../../context/CloseModalProvider';
import { ProgressContext } from '../../context/ProgressProvider';
import { MESSAGE, PATH } from '../../../utils/constants';
import { CloseModalContext } from '../../../context/CloseModalProvider';
import { ProgressContext } from '../../../context/ProgressProvider';
import CarSelectContainer from './CarSelectContainer';

interface INavItem extends React.HTMLAttributes<HTMLLIElement> {
active: boolean;
Expand All @@ -16,6 +17,7 @@ export default function NavBar() {
const { nextStepAvailable } = useContext(ProgressContext);
const { pathname: currentPath } = useLocation();
const { setVisible: setCloseModalVisible } = useContext(CloseModalContext);
const [menuVisible, setMenuVisible] = useState<boolean>(false);
const theme = useTheme();

const handleNavItemClick = (path: string) => {
Expand All @@ -31,14 +33,16 @@ export default function NavBar() {
const handleCloseButtonClick = () => {
setCloseModalVisible(true);
};
const handleCarSelectClick = () => {
setMenuVisible((cur) => !cur);
};

return (
<>
<Wrapper>
<Wrapper>
<NavContainer $menuVisible={menuVisible}>
<Body>
<HyundaiLogo src={hyundaiLogo} alt="" />

<CarSelect>
<CarSelect onClick={handleCarSelectClick}>
<span>펠리세이드</span>
<ArrowDown fill={theme.color.gray800} />
</CarSelect>
Expand Down Expand Up @@ -79,8 +83,9 @@ export default function NavBar() {
<CancelIcon width={12} height={12} />
</CancelButton>
</Body>
</Wrapper>
</>
</NavContainer>
<CarSelectContainer visible={menuVisible} />
</Wrapper>
);
}

Expand All @@ -95,7 +100,12 @@ function NavItem({ active, ...props }: INavItem) {
}

const Wrapper = styled.div`
z-index: 999;
display: flex;
flex-direction: column;
`;

const NavContainer = styled.div<{ $menuVisible: boolean }>`
z-index: ${({ $menuVisible }) => ($menuVisible ? 9999999999999 : 999)};
position: fixed;
top: 0px;
left: 0px;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/modal/GuideModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HTMLAttributes, MouseEventHandler, useContext, useLayoutEffect, useRef
import { styled } from 'styled-components';
import { Bubble, CloseIcon } from '../common/icons/Icons';
import { BodyKrRegular3, HeadingKrMedium7 } from '../../styles/typefaces';
import CenterWrapper from '../layout/CenterWrapper';
import CenterWrapper from '../common/layout/CenterWrapper';
import { DimmedBackground } from './DimmedBackground';
import { GuideModalContext } from '../../context/GuideModalProvider';
import { useLocation } from 'react-router-dom';
Expand Down
12 changes: 10 additions & 2 deletions frontend/src/components/priceStaticBar/PriceStaticSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { styled } from 'styled-components';
import { flexCenterCss } from '../../utils/commonStyle';
import { BodyKrRegular5 } from '../../styles/typefaces';
import { BodyKrRegular3, BodyKrRegular5 } from '../../styles/typefaces';
import { ChangeEvent, useContext } from 'react';
import { ItemContext } from '../../context/ItemProvider';
import { TEN_THOUSAND_UNIT } from '../../utils/constants';
Expand All @@ -25,14 +25,15 @@ export default function Slider({
return (
<PriceBarWrapper {...props}>
<MarkerSvgWrapper>
<Budget>예산: {budget / TEN_THOUSAND_UNIT}</Budget>
<PriceBar
type="range"
min={selectedItem.trim.price}
max={highestPrice}
value={budget}
onChange={handleChange}
onMouseDown={stopEvent}
step={10}
step={100_000}
$percent={
((budget - selectedItem.trim.price) / (highestPrice - selectedItem.trim.price)) * 100
}
Expand All @@ -59,6 +60,13 @@ export default function Slider({
const PriceBarWrapper = styled.div`
padding-top: 28px;
padding-bottom: 4px;
position: relative;
`;
const Budget = styled.span`
${BodyKrRegular3}
position: absolute;
top: -25px;
right: 0px;
`;

const MarkerSvgWrapper = styled.div`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { styled } from 'styled-components';
import PriceSummary from '../../components/summary/PriceSummary';
import { PATH } from '../../utils/constants';
import CenterWrapper from '../../components/layout/CenterWrapper';
import CenterWrapper from '../../components/common/layout/CenterWrapper';

export default function InnerColorFooterContainer() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactNode, useCallback, useContext, useEffect, useState } from 'react';
import { styled } from 'styled-components';
import CenterWrapper from '../../components/layout/CenterWrapper';
import CenterWrapper from '../../components/common/layout/CenterWrapper';
import InnerColorCard from '../../components/cards/InnerColorCard';
import CardSlider from '../../components/cardSlider/CardSlider';
import { NUM_IN_A_PAGE } from '../../utils/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useFetch } from '../../hooks/useFetch';
import { BodyKrRegular4 } from '../../styles/typefaces';
import Banner from '../../components/common/banner/Banner';
import HmgTag from '../../components/common/hmgTag/HmgTag';
import CenterWrapper from '../../components/layout/CenterWrapper';
import CenterWrapper from '../../components/common/layout/CenterWrapper';
import PowerTrainData from '../../components/powerTrainData/PowerTrainData';
import { IHmgData, ModelTypeContext } from '../../context/ModelTypeProvider';
import { MODEL_TYPE_API, IMG_URL } from '../../utils/apis';
Expand Down
Loading

0 comments on commit 78a2584

Please sign in to comment.