Skip to content

Commit

Permalink
[Fix]회원가입/로그인/프로필창에서 엔터키 유효
Browse files Browse the repository at this point in the history
엔터키 누르면 다음 입력창/버튼을 클릭하도록 로직 수정
회원가입 시 닉네임 대신 이름 쓰도록 변경
비밀번호 설정 시 대문자 넣어도 되고 안넣어도 되도록 변경
Issues #15
  • Loading branch information
김병현 authored and 김병현 committed Sep 19, 2023
2 parents 588a352 + 38b6f2a commit 2e29de6
Show file tree
Hide file tree
Showing 39 changed files with 2,933 additions and 1,300 deletions.
111 changes: 111 additions & 0 deletions client/src/components/CentralChart/CompareChartBtn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { useState } from "react";
import { styled } from "styled-components";
import useCompanyData from "../../hooks/useCompanyData";

import CompareList from "./CompareList";
import IconImg from "../../asset/CentralSectionMenu-compareChart.png";

const buttonText: string = "비교종목";

const CompareChartBtn = () => {
const { data: companyList } = useCompanyData(1, 14);
const [compare, setCompare] = useState(false);

const handleOnCompareList = () => {
setCompare(true);
};

const handleOffCompareList = () => {
setCompare(false);
};

return (
<Container>
<div className="compareButtonContainer">
<Icon src={IconImg} />
<div className="compareButton" onMouseOver={handleOnCompareList}>
{buttonText}
</div>
</div>
{compare && (
<CompareContainer onMouseOver={handleOnCompareList} onMouseLeave={handleOffCompareList}>
<StockList>
{companyList?.map((company) => {
const corpName = company.korName;
const companyId = company.companyId;

return <CompareList corpName={corpName} compareCompanyId={companyId} />;
})}
</StockList>
</CompareContainer>
)}
</Container>
);
};

export default CompareChartBtn;

const Container = styled.div`
position: absolute;
width: 100%;
height: 100%;
display: flex;
justify-content: flex-end;
align-items: flex-start;
padding-top: 10px;
padding-right: 13px;
.compareButtonContainer {
display: flex;
flex-direction: row;
z-index: 2;
}
.compareButton {
display: flex;
justify-content: center;
align-items: center;
font-size: 12px;
padding-top: 2.5px;
cursor: pointer;
}
`;

const Icon = styled.img`
width: auto;
height: 18px;
padding-top: 0.5px;
padding-right: 3px;
`;

const CompareContainer = styled.div`
position: relative;
z-index: 1;
`;

const StockList = styled.div`
position: absolute;
right: 0;
top: 24px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 12px;
font-weight: 500;
line-height: 147%;
width: 92px;
height: 260px;
padding: 5px;
border-radius: 0.4rem;
z-index: 2;
border: none;
color: #b7b5b5;
background-color: #bfdaf6e8;
opacity: 0.65;
`;
34 changes: 34 additions & 0 deletions client/src/components/CentralChart/CompareList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { useSelector, useDispatch } from "react-redux";
import { setCompareStock } from "../../reducer/CompareChart-Reducer";
import { StateProps } from "../../models/stateProps";
import { styled } from "styled-components";

const CompareList = (props: OwnProps) => {
const { corpName, compareCompanyId } = props;

const dispatch = useDispatch();
const currentCompanyid = useSelector((state: StateProps) => state.companyId);

const handleSelectCompareStock = () => {
if (currentCompanyid === compareCompanyId) {
return;
}
dispatch(setCompareStock(compareCompanyId));
};

return <Contianer onClick={handleSelectCompareStock}>{corpName}</Contianer>;
};
export default CompareList;

interface OwnProps {
corpName: string;
compareCompanyId: number;
}

const Contianer = styled.div`
&:hover {
color: black;
transition: color 0.3s ease;
cursor: pointer;
}
`;
15 changes: 14 additions & 1 deletion client/src/components/CentralChart/StockChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { StateProps } from "../../models/stateProps";

import useGetStockData from "../../hooks/useGetStockData";
import useGetStockChart from "../../hooks/useGetStockChart";
import CompareChartBtn from "./CompareChartBtn";

const loadingText = "로딩 중 입니다...";
const errorText = "화면을 불러올 수 없습니다";
Expand All @@ -25,20 +26,32 @@ const StockChart = () => {

return (
<Container>
<EChartsReact option={options} style={chartStyle} />
<ChartContainer>
<EChartsReact option={options} style={chartStyle} />
</ChartContainer>
<CompareChartBtn />
</Container>
);
};

export default StockChart;

const Container = styled.div`
position: relative;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
overflow: hidden;
z-index: 1;
`;

const ChartContainer = styled.div`
position: absolute;
width: 100%;
height: 100%;
z-index: 1;
`;

const LoadingContainer = styled.div`
Expand Down
71 changes: 35 additions & 36 deletions client/src/components/CentralChartMenu/StockOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import { StateProps } from "../../models/stateProps";

// dummyData
import dummyLogo from "../../asset/CentralSectionMenu-dummyImg.png";
import kia from '../../asset/logos/기아.svg';
import dy from '../../asset/logos/디와이.jpeg';
import logosamsung from '../../asset/logos/삼성전자.svg';
import celltrion from '../../asset/logos/셀트리온.svg';
import ecopro from '../../asset/logos/에코프로.jpeg';
import ecoproBM from '../../asset/logos/에코프로비엠.svg';
import kakaoBank from '../../asset/logos/카카오뱅크.svg';
import kuckoo from '../../asset/logos/쿠쿠홀딩스.jpeg';
import hanse from '../../asset/logos/한세엠케이.jpeg';
import hyundai from '../../asset/logos/현대차.svg';
import KG from '../../asset/logos/KG케미칼.png';
import LGelec from '../../asset/logos/LG전자.svg';
import LGchem from '../../asset/logos/LG화학.svg';
import posco from '../../asset/logos/POSCO홀딩스.svg';
import kia from "../../asset/logos/기아.svg";
import dy from "../../asset/logos/디와이.jpeg";
import logosamsung from "../../asset/logos/삼성전자.svg";
import celltrion from "../../asset/logos/셀트리온.svg";
import ecopro from "../../asset/logos/에코프로.jpeg";
import ecoproBM from "../../asset/logos/에코프로비엠.svg";
import kakaoBank from "../../asset/logos/카카오뱅크.svg";
import kuckoo from "../../asset/logos/쿠쿠홀딩스.jpeg";
import hanse from "../../asset/logos/한세엠케이.jpeg";
import hyundai from "../../asset/logos/현대차.svg";
import KG from "../../asset/logos/KG케미칼.png";
import LGelec from "../../asset/logos/LG전자.svg";
import LGchem from "../../asset/logos/LG화학.svg";
import posco from "../../asset/logos/POSCO홀딩스.svg";

const marketType: string = "코스피";
const volumeText: string = "거래량";
Expand All @@ -33,26 +33,26 @@ const StockOverview = () => {

// 이미 import된 로고들을 바탕으로 logos 객체 생성
const logos: LogoPaths = {
'삼성전자': logosamsung,
'POSCO홀딩스': posco,
'셀트리온': celltrion,
'에코프로': ecopro,
'에코프로비엠': ecoproBM,
'디와이': dy,
'쿠쿠홀딩스': kuckoo,
'카카오뱅크': kakaoBank,
'한세엠케이': hanse,
'KG케미칼': KG,
'LG화학': LGchem,
'현대차': hyundai,
'LG전자': LGelec,
'기아': kia,
};
// 그리고 나서, 이 `logos` 객체를 사용하여 기업명에 따라 적절한 로고를 선택할 수 있습니다.
const companyLogo = corpName ? logos[corpName] || dummyLogo : dummyLogo;
if (!corpName) {
return null; // 혹은 다른 적절한 렌더링을 반환
}
삼성전자: logosamsung,
POSCO홀딩스: posco,
셀트리온: celltrion,
에코프로: ecopro,
에코프로비엠: ecoproBM,
디와이: dy,
쿠쿠홀딩스: kuckoo,
카카오뱅크: kakaoBank,
한세엠케이: hanse,
KG케미칼: KG,
LG화학: LGchem,
현대차: hyundai,
LG전자: LGelec,
기아: kia,
};
// 그리고 나서, 이 `logos` 객체를 사용하여 기업명에 따라 적절한 로고를 선택할 수 있습니다.
const companyLogo = corpName ? logos[corpName] || dummyLogo : dummyLogo;
if (!corpName) {
return null; // 혹은 다른 적절한 렌더링을 반환
}

if (stockInfoLoading) {
return <p>로딩 중 입니다</p>;
Expand All @@ -62,7 +62,6 @@ const StockOverview = () => {
return <p>에러 발생</p>;
}


const stockCode = stockInfo.code;
const stockPrice = parseInt(stockInfo.stockInfResponseDto.stck_prpr, 10).toLocaleString();
const priceChageRate = parseFloat(stockInfo.stockInfResponseDto.prdy_ctrt);
Expand All @@ -77,7 +76,7 @@ const StockOverview = () => {

return (
<Container priceChangeRate={priceChageRate}>
<img className="CorpLogo" src={companyLogo} alt="stock logo"/>
<img className="CorpLogo" src={companyLogo} alt="stock logo" />
<div className="CorpName">{corpName}</div>
<div className="StockCode">
{stockCode} <span>{marketType}</span>
Expand Down
Loading

0 comments on commit 2e29de6

Please sign in to comment.