-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 중앙차트 z-index 부여에 따른 모달창 z-index 수정 Issues #14
- Loading branch information
1 parent
a43b407
commit c9dcab5
Showing
13 changed files
with
617 additions
and
464 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
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 handleCompareChart = () => { | ||
setCompare(!compare); | ||
}; | ||
|
||
// console.log(companyList); | ||
|
||
return ( | ||
<Container> | ||
<div className="compareButtonContainer"> | ||
<Icon src={IconImg} /> | ||
<div className="compareButton" onClick={handleCompareChart}> | ||
{buttonText} | ||
</div> | ||
</div> | ||
{compare && ( | ||
<CompareContainer> | ||
<StockList> | ||
{companyList?.map((company) => { | ||
const corpName = company.korName; | ||
const companyId = company.companyId; | ||
console.log(corpName); | ||
|
||
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: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100vw; | ||
height: 100vh; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
`; | ||
|
||
const StockList = styled.div` | ||
position: absolute; | ||
width: 100px; | ||
height: 300px; | ||
z-index: 2; | ||
background-color: white; | ||
`; |
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,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 compareInfo = useSelector((state: StateProps) => state.compareChart); | ||
// console.log(compareInfo); | ||
// | ||
|
||
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``; |
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
Oops, something went wrong.