Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
[feat] 포트폴리오 상태 영역 구현 및 공용 컴포넌트 구현 (#72)
Browse files Browse the repository at this point in the history
* #39 feat : Portfolio base Page 구현

* #40 refactor : MUI 문제 해결
- @emotion/react, @emotion/styled 패키지 추가
- tsconfig resolve 삭제
- main에 StyledEngineProvider 추가

* #40 feat : 모달 관련 공용 컴포넌트 구현
- Confirm과 PortfolioModal에 공용으로 사용할 baseModal 구현
- Confirm, PortfolioModal 구현

* #40 feat : MUI를 활용한 ToggleSwitch 구현

* #40 refactor : 포트폴리오 data에 securitiesFirm 추가

* #40 feat : PortfolioOverview 컴포넌트 구현

* #40 rename : Confirm -> ConfirmAlert으로 변경

* #40 refactor : destructuring 컨벤션에 맞게 수정

* #40 refactor : destructuring 컨벤션에 맞게 수정

* #40 refactor : 불필요한 useEffect 제거

---------

Co-authored-by: Daeram Chung <[email protected]>
  • Loading branch information
altmit and Kakamotobi authored Oct 30, 2023
1 parent 4dc2123 commit fcad142
Show file tree
Hide file tree
Showing 12 changed files with 1,028 additions and 1,728 deletions.
2,091 changes: 376 additions & 1,715 deletions fe/package-lock.json

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions fe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
"test": "jest"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@lukemorales/query-key-factory": "^1.3.2",
"@mui/icons-material": "^5.14.14",
"@mui/material": "^5.14.13",
"@mui/styled-engine-sc": "^6.0.0-alpha.1",
"@mui/icons-material": "^5.14.15",
"@mui/material": "^5.14.15",
"@mui/styled-engine-sc": "^6.0.0-alpha.3",
"@react-oauth/google": "^0.11.1",
"@tanstack/react-query": "^4.36.1",
"@types/recharts": "^1.8.26",
Expand All @@ -27,7 +29,7 @@
"react-router-dom": "^6.16.0",
"react-verification-input": "^3.3.1",
"recharts": "^2.9.0",
"styled-components": "^6.0.8"
"styled-components": "^6.1.0",
},
"devDependencies": {
"@testing-library/react": "^14.0.0",
Expand Down
1 change: 1 addition & 0 deletions fe/src/api/portfolio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type Portfolio = {

export type PortfolioDetails = {
id: number;
securitiesFirm: string;
name: string;
budget: number;
targetGain: number;
Expand Down
33 changes: 33 additions & 0 deletions fe/src/components/BaseModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Box, Modal } from "@mui/material";
import { ReactElement } from "react";
import { CSSProperties } from "styled-components";

type Props = {
style?: CSSProperties;
children: ReactElement;
isOpen: boolean;
onClose: () => void;
};

export default function BaseModal({ style, children, isOpen, onClose }: Props) {
return (
<Modal open={isOpen} onClose={onClose}>
<Box sx={{ ...baseStyle, ...style }}>{children}</Box>
</Modal>
);
}

const baseStyle = {
width: "700px",
height: "430px",
backgroundColor: "#ffffff",
border: "1px solid black",
borderRadius: "8px",
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
bgcolor: "background.paper",
boxShadow: 24,
p: 4,
};
70 changes: 70 additions & 0 deletions fe/src/components/ConfirmAlert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { Button } from "@mui/material";
import styled from "styled-components";
import BaseModal from "./BaseModal";

type Props = {
isOpen: boolean;
title: string;
content: string;
onClose: () => void;
onConfirm: () => void;
};

export default function ConfirmAlert({
isOpen,
title,
content,
onClose,
onConfirm,
}: Props) {
const onConfirmAlertClose = () => {
onConfirm();
onClose();
};

return (
<BaseModal style={ConfirmAlertStyle} isOpen={isOpen} onClose={onClose}>
<Wrapper>
<Title>{title}</Title>
<Body>{content}</Body>
<ButtonWrapper>
<CancelButton onClick={onClose}>취소</CancelButton>
<Button onClick={onConfirmAlertClose}>확인</Button>
</ButtonWrapper>
</Wrapper>
</BaseModal>
);
}

const ConfirmAlertStyle = {
width: "400px",
height: "180px",
};

const Wrapper = styled.div`
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
`;

const Title = styled.div`
width: 100%;
text-align: left;
font-size: 16px;
font-weight: bold;
`;

const Body = styled.div`
width: 100%;
`;

const ButtonWrapper = styled.div`
width: 100%;
text-align: right;
`;

const CancelButton = styled(Button)`
color: red;
`;
Loading

0 comments on commit fcad142

Please sign in to comment.