@@ -82,12 +80,7 @@ const PriceInfo = (props: PriceInfoProps) => {
{volume}
-
+
);
@@ -103,6 +96,8 @@ interface PriceInfoProps {
interface InfoContainerProps {
index: number;
+ price: number;
+ orderPrice: number;
}
interface VolumeProps {
@@ -147,6 +142,7 @@ const InfoContainer = styled.div
`
margin-bottom: 2px;
background-color: ${(props) => (props.index > 9 ? "#FDE8E7" : "#E7F0FD")};
border: ${(props) => (props.index === 10 ? "1px solid #2F4F4F" : "none")};
+ border-left: ${(props) => (props.price === props.orderPrice ? "3px solid red" : props.index > 9 ? "3px solid #FDE8E7" : "3px solid #E7F0FD")};
display: flex;
flex-direction: row;
`;
@@ -154,7 +150,7 @@ const InfoContainer = styled.div`
const Price = styled.div`
width: 50%;
display: flex;
- padding-right: 8px;
+ padding-right: 11px;
flex-direction: column;
align-items: flex-end;
@@ -190,12 +186,7 @@ const Volume = styled.div`
`;
const VolumePercentge = styled.span`
- width: ${(props) =>
- (props.volume /
- (props.index < 10
- ? props.upperPriceVolumeSum
- : props.lowerPriceVolumeSum)) *
- 100}%;
+ width: ${(props) => (props.volume / (props.index < 10 ? props.upperPriceVolumeSum : props.lowerPriceVolumeSum)) * 100}%;
height: 2px;
background-color: ${(props) => (props.index < 10 ? "#2679ed" : "#e22926")};
diff --git a/client/src/components/StockOrderSection/dummyData.ts b/client/src/components/StockOrderSection/dummyData.ts
index 87285c75..285cf917 100644
--- a/client/src/components/StockOrderSection/dummyData.ts
+++ b/client/src/components/StockOrderSection/dummyData.ts
@@ -1,5 +1,6 @@
// dummyData
export const dummyPrice: dummyProps[] = [
+ { price: 200, changeRate: 90, volume: 300 },
{ price: 190, changeRate: 90, volume: 500 },
{ price: 180, changeRate: 80, volume: 120 },
{ price: 170, changeRate: 70, volume: 78 },
@@ -19,8 +20,8 @@ export const dummyPrice: dummyProps[] = [
{ price: 30, changeRate: -70, volume: 1100 },
{ price: 20, changeRate: -80, volume: 800 },
{ price: 10, changeRate: -90, volume: 500 },
- { price: 5, changeRate: -95, volume: 800 },
];
+export const standardPrice = 100;
export const upperPriceVolumeSum = 1000;
export const lowerPriceVolumeSum = 2000;
export const availableMoney = 10000000;
diff --git a/client/src/models/stateProps.ts b/client/src/models/stateProps.ts
index 7ea6ad4b..4d308885 100644
--- a/client/src/models/stateProps.ts
+++ b/client/src/models/stateProps.ts
@@ -1,3 +1,5 @@
export interface StateProps {
stockOrderType: boolean;
+ stockPriceType: boolean;
+ stockOrderPrice: number;
}
diff --git a/client/src/reducer/StockOrderPrice-Reducer.ts b/client/src/reducer/StockOrderPrice-Reducer.ts
new file mode 100644
index 00000000..790eff3a
--- /dev/null
+++ b/client/src/reducer/StockOrderPrice-Reducer.ts
@@ -0,0 +1,26 @@
+import { createSlice } from "@reduxjs/toolkit";
+import { dummyPrice } from "../components/StockOrderSection/dummyData";
+
+const initialState: number = dummyPrice[10].price;
+
+const stockPriceOrderSlice = createSlice({
+ name: "stockOrderPrice",
+ initialState: initialState,
+ reducers: {
+ setStockOrderPrice: (state, action) => {
+ return action.payload;
+ },
+ plusStockOrderPrice: (state, action) => {
+ return state + action.payload;
+ },
+ minusStockOrderPrice: (state, action) => {
+ if (state > action.payload) {
+ return state - action.payload;
+ }
+ return state;
+ },
+ },
+});
+
+export const { setStockOrderPrice, plusStockOrderPrice, minusStockOrderPrice } = stockPriceOrderSlice.actions;
+export const stockOrderPriceReducer = stockPriceOrderSlice.reducer;
diff --git a/client/src/reducer/StockPriceType-Reducer.ts b/client/src/reducer/StockPriceType-Reducer.ts
new file mode 100644
index 00000000..1bb2062a
--- /dev/null
+++ b/client/src/reducer/StockPriceType-Reducer.ts
@@ -0,0 +1,15 @@
+import { createSlice } from "@reduxjs/toolkit";
+
+const initialState: boolean = false;
+
+const stockPriceTypeSlice = createSlice({
+ name: "stockPriceType",
+ initialState: initialState,
+ reducers: {
+ setSpecifiedPrice: () => false,
+ setMarketPrice: () => true,
+ },
+});
+
+export const { setSpecifiedPrice, setMarketPrice } = stockPriceTypeSlice.actions;
+export const stockPriceTypeReducer = stockPriceTypeSlice.reducer;
diff --git a/client/src/store/config.ts b/client/src/store/config.ts
index 622cb788..2a5b7c14 100644
--- a/client/src/store/config.ts
+++ b/client/src/store/config.ts
@@ -1,9 +1,13 @@
import { configureStore } from "@reduxjs/toolkit";
import { stockOrderTypeReducer } from "../reducer/StockOrderType-Reducer";
+import { stockPriceTypeReducer } from "../reducer/stockPriceType-Reducer";
+import { stockOrderPriceReducer } from "../reducer/StockOrderPrice-Reducer";
const store = configureStore({
reducer: {
stockOrderType: stockOrderTypeReducer,
+ stockPriceType: stockPriceTypeReducer,
+ stockOrderPrice: stockOrderPriceReducer,
},
});