-
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.
Merge pull request #48 from codestates-seb/dev-client#43/ComponentCon…
…nect [FE] #43 컴포넌트 연결 및 코드 리팩토링
- Loading branch information
Showing
35 changed files
with
690 additions
and
721 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
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
35 changes: 35 additions & 0 deletions
35
client/src/components/CentralChartMenu/ChangeChartCycleBtn.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,35 @@ | ||
import { styled } from "styled-components"; | ||
|
||
const chartCylceText01: string = "30분"; | ||
const chartCylceText02: string = "일"; | ||
const chartCylceText03: string = "주"; | ||
const chartCylceText04: string = "월"; | ||
const chartCylceText05: string = "년"; | ||
|
||
const ChangeChartCycleBtn = () => { | ||
return ( | ||
<Container> | ||
<Button>{chartCylceText01}</Button> | ||
<Button>{chartCylceText02}</Button> | ||
<Button>{chartCylceText03}</Button> | ||
<Button>{chartCylceText04}</Button> | ||
<Button>{chartCylceText05}</Button> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default ChangeChartCycleBtn; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
gap: 4px; | ||
`; | ||
|
||
const Button = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding-right: 14px; | ||
color: #999999; | ||
`; |
File renamed without changes.
55 changes: 55 additions & 0 deletions
55
client/src/components/CentralChartMenu/ExpandScreenBtn.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,55 @@ | ||
import { useDispatch } from "react-redux"; | ||
import { styled } from "styled-components"; | ||
import { changeLeftScreen, changeRightScreen } from "../../reducer/ExpandScreen-Reducer"; | ||
|
||
const expandLeft: string = "<"; | ||
const expandRight: string = ">"; | ||
|
||
const ExpandScreenBtn = (props: OwnProps) => { | ||
const { direction } = props; | ||
|
||
const dispatch = useDispatch(); | ||
|
||
const handleChangeLeftScreen = () => { | ||
dispatch(changeLeftScreen()); | ||
}; | ||
|
||
const handleChangeRightScreen = () => { | ||
dispatch(changeRightScreen()); | ||
}; | ||
|
||
if (direction === "left") { | ||
return ( | ||
<Button direction="left" onClick={handleChangeLeftScreen}> | ||
{expandLeft} | ||
</Button> | ||
); | ||
} | ||
|
||
if (direction === "right") { | ||
return ( | ||
<Button direction="right" onClick={handleChangeRightScreen}> | ||
{expandRight} | ||
</Button> | ||
); | ||
} | ||
}; | ||
|
||
export default ExpandScreenBtn; | ||
|
||
// type 정의 | ||
interface OwnProps { | ||
direction: string; | ||
} | ||
|
||
// component 생성 | ||
const Button = styled.div<OwnProps>` | ||
width: 43px; | ||
height: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
font-size: 22px; | ||
border-right: ${(props) => props.direction === "left" && "1px solid darkgray"}; | ||
border-left: ${(props) => props.direction === "right" && "1px solid darkgray"}; | ||
`; |
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,52 @@ | ||
import { styled } from "styled-components"; | ||
|
||
import ExpandScreenBtn from "./ExpandScreenBtn"; | ||
import StockOverview from "./StockOverview"; | ||
import BookmarkBtn from "./BookmarkBtn"; | ||
import StockOrderBtn from "./StockOrderBtn"; | ||
import CompareChartBtn from "./CompareChartBtn"; | ||
import ChangeChartCycleBtn from "./ChangeChartCycleBtn"; | ||
|
||
const UpperMenuBar = () => { | ||
return ( | ||
<Container> | ||
<div className="FirstLine"> | ||
<ExpandScreenBtn direction="left" /> | ||
<StockOverview /> | ||
<BookmarkBtn /> | ||
<StockOrderBtn type="buying" /> | ||
<StockOrderBtn type="selling" /> | ||
<ExpandScreenBtn direction="right" /> | ||
</div> | ||
<div className="SecondLine"> | ||
<CompareChartBtn /> | ||
<ChangeChartCycleBtn /> | ||
</div> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default UpperMenuBar; | ||
|
||
const Container = styled.div` | ||
width: 100%; | ||
text-align: center; | ||
.FirstLine { | ||
width: 100%; | ||
height: 44px; | ||
display: flex; | ||
flex-direction: row; | ||
border-bottom: 1px solid darkgray; | ||
} | ||
.SecondLine { | ||
width: 100%; | ||
height: 40px; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: center; | ||
border-bottom: 1px solid darkgray; | ||
} | ||
`; |
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,60 @@ | ||
import { useDispatch } from "react-redux"; | ||
import { styled } from "styled-components"; | ||
import { stockOrderOpen } from "../../reducer/StockOrderSet-Reducer"; | ||
import { orderTypeBuying, orderTypeSelling } from "../../reducer/StockOrderType-Reducer"; | ||
|
||
const StockOrderBtn = (props: OwnProps) => { | ||
const { type } = props; | ||
const buttonText: string = type === "buying" ? "매수" : "매도"; | ||
|
||
const dispatch = useDispatch(); | ||
|
||
const handleStockOrderSet = () => { | ||
dispatch(stockOrderOpen()); | ||
|
||
if (type === "buying") { | ||
dispatch(orderTypeBuying()); | ||
} else { | ||
dispatch(orderTypeSelling()); | ||
} | ||
}; | ||
|
||
return ( | ||
<Container> | ||
<Button type={type} onClick={handleStockOrderSet}> | ||
{buttonText} | ||
</Button> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default StockOrderBtn; | ||
|
||
// type 정의 | ||
interface OwnProps { | ||
type: string; | ||
} | ||
|
||
// component 생성 | ||
const Container = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding-right: 12px; | ||
`; | ||
|
||
const Button = styled.div<OwnProps>` | ||
width: 44px; | ||
height: 24px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
font-size: 12px; | ||
color: ${(props) => (props.type === "buying" ? "#cc3c3a" : "#4479c2")}; | ||
background-color: ${(props) => (props.type === "buying" ? "#fcdddb" : "#dce9fc")}; | ||
padding-top: 2px; | ||
border-radius: 0.2rem; | ||
`; |
Oops, something went wrong.