This repository was archived by the owner on Nov 8, 2023. It is now read-only.
forked from codesquad-members-2023/FineAnts-team-02
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] 포트폴리오 상태 영역 구현 및 공용 컴포넌트 구현 (#72)
* #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
1 parent
4dc2123
commit fcad142
Showing
12 changed files
with
1,028 additions
and
1,728 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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, | ||
}; |
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,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; | ||
`; |
Oops, something went wrong.