diff --git a/client/src/components/StockOrderSection/StockPrice.tsx b/client/src/components/StockOrderSection/StockPrice.tsx index 49690418..4c6ad3a8 100644 --- a/client/src/components/StockOrderSection/StockPrice.tsx +++ b/client/src/components/StockOrderSection/StockPrice.tsx @@ -1,10 +1,49 @@ import { styled } from "styled-components"; +// dummyData +const dummyPrice: dummyProps[] = [ + { price: 190, changeRate: 90, volume: 500 }, + { price: 180, changeRate: 80, volume: 120 }, + { price: 170, changeRate: 70, volume: 78 }, + { price: 160, changeRate: 60, volume: 55 }, + { price: 150, changeRate: 50, volume: 91 }, + { price: 140, changeRate: 40, volume: 300 }, + { price: 130, changeRate: 30, volume: 10 }, + { price: 120, changeRate: 20, volume: 80 }, + { price: 110, changeRate: 10, volume: 40 }, + { price: 100, changeRate: 0, volume: 180 }, + { price: 90, changeRate: -10, volume: 250 }, + { price: 80, changeRate: -20, volume: 1000 }, + { price: 70, changeRate: -30, volume: 900 }, + { price: 60, changeRate: -40, volume: 850 }, + { price: 50, changeRate: -50, volume: 154 }, + { price: 40, changeRate: -60, volume: 820 }, + { price: 30, changeRate: -70, volume: 1100 }, + { price: 20, changeRate: -80, volume: 800 }, + { price: 10, changeRate: -90, volume: 500 }, + { price: 5, changeRate: -95, volume: 800 }, +]; +const upperPriceVolumeSum = 1000; +const lowerPriceVolumeSum = 2000; +// + const StockPrice = () => { return ( - + + {dummyPrice.map((item, idx) => ( + + ))} + ); @@ -12,11 +51,78 @@ const StockPrice = () => { export default StockPrice; +const PriceInfo = (props: PriceInfoProps) => { + const { + upperPriceVolumeSum, + lowerPriceVolumeSum, + index, + price, + changeRate, + volume, + } = props; + + const changeRateText01: string = changeRate > 0 ? "+" : ""; + const changeRateText02: string = "%"; + + return ( + + +
{price}
+
+ {changeRateText01} + {changeRate} + {changeRateText02} +
+
+ +
{volume}
+ +
+
+ ); +}; + +// dummy 관련 변수 +interface dummyProps { + price: number; + changeRate: number; + volume: number; +} + +interface PriceInfoProps { + upperPriceVolumeSum: number; + lowerPriceVolumeSum: number; + index: number; + price: number; + changeRate: number; + volume: number; +} + +interface InfoContainerProps { + index: number; +} + +interface VolumeProps { + index: number; +} + +interface VolumePercentageProps { + index: number; + volume: number; + upperPriceVolumeSum: number; + lowerPriceVolumeSum: number; +} + +// component 생성 const Container = styled.div` width: 40%; height: 100%; margin-right: 16px; - border-right: 1px solid black; `; const HighFigure = styled.div` @@ -25,10 +131,75 @@ const HighFigure = styled.div` border-bottom: 1px solid black; `; -const PriceInfo = styled.div` +const PriceList = styled.ul` width: 100%; height: 348px; + padding: 0px; border-bottom: 1px solid black; + overflow-y: scroll; + + &::-webkit-scrollbar { + display: none; + } +`; + +const InfoContainer = styled.div` + width: 100%; + height: 36px; + margin-bottom: 2px; + background-color: ${(props) => (props.index > 9 ? "#FDE8E7" : "#E7F0FD")}; + display: flex; + flex-direction: row; +`; + +const Price = styled.div` + width: 50%; + display: flex; + padding-right: 8px; + flex-direction: column; + align-items: flex-end; + + .price { + font-size: 14px; + font-weight: 400; + padding-top: 1px; + } + + .changeRate { + font-size: 12px; + font-weight: 400; + color: #e22926; + padding-top: 1px; + } +`; + +const Volume = styled.div` + width: 50%; + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: flex-end; + font-size: 12px; + color: ${(props) => (props.index < 10 ? "#2679ed" : "#e22926")}; + + .volume { + height: 100%; + display: flex; + align-items: center; + padding-right: 8px; + } +`; + +const VolumePercentge = styled.span` + width: ${(props) => + (props.volume / + (props.index < 10 + ? props.upperPriceVolumeSum + : props.lowerPriceVolumeSum)) * + 100}%; + + height: 2px; + background-color: ${(props) => (props.index < 10 ? "#2679ed" : "#e22926")}; `; const LowerFigure = styled.div` diff --git a/client/src/components/StockOrderSection/VolumeSetteing.tsx b/client/src/components/StockOrderSection/VolumeSetteing.tsx index 18cd8bd8..b78300ae 100644 --- a/client/src/components/StockOrderSection/VolumeSetteing.tsx +++ b/client/src/components/StockOrderSection/VolumeSetteing.tsx @@ -121,7 +121,7 @@ const PercentageBox = styled.div` margin-top: 8px; & button { - width: 46px; + width: 56px; height: 28px; border: none; border-radius: 0.2rem;