-
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.
Merge pull request #343 from Leets-Official/feat#332/기수-관련-ui
#332 Feat:기수 관련 UI
- Loading branch information
Showing
19 changed files
with
538 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"cSpell.words": ["Admincardinal"] | ||
} |
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,41 @@ | ||
import theme from '@/styles/theme'; | ||
import styled from 'styled-components'; | ||
import plusIcon from '@/assets/images/ic_admin_plus.svg'; | ||
import { useState } from 'react'; | ||
import CardinalModal from '@/components/Admin/Modal/CardinalModal'; | ||
|
||
export const AddCardinalWrapper = styled.div` | ||
width: 80px; | ||
height: 164px; | ||
box-sizing: border-box; | ||
background-color: ${theme.color.gray[100]}; | ||
display: flex; | ||
justify-content: center; | ||
text-align: center; | ||
align-items: center; | ||
cursor: pointer; | ||
`; | ||
|
||
const AddCardinal: React.FC = () => { | ||
const [isModalOpen, setIsModalOpen] = useState(false); | ||
|
||
const handleOpenModal = () => { | ||
setIsModalOpen(true); | ||
}; | ||
|
||
const handleCloseModal = () => { | ||
setIsModalOpen(false); | ||
}; | ||
|
||
return ( | ||
<> | ||
<AddCardinalWrapper onClick={handleOpenModal}> | ||
<img src={plusIcon} alt="plus" /> | ||
</AddCardinalWrapper> | ||
|
||
<CardinalModal isOpen={isModalOpen} onClose={handleCloseModal} /> | ||
</> | ||
); | ||
}; | ||
|
||
export default AddCardinal; |
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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import React, { useState } from 'react'; | ||
import Button from '@/components/Button/Button'; | ||
import * as S from '@/styles/admin/cardinal/AdminCardinal.styled'; | ||
import CommonCardinalModal from './CommonCardinalModal'; | ||
|
||
interface CardinalChangeModalProps { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
top?: string; | ||
left?: string; | ||
position?: 'center' | 'absolute' | 'fixed'; | ||
overlayColor?: string; | ||
} | ||
|
||
const CardinalEditModal: React.FC<CardinalChangeModalProps> = ({ | ||
isOpen, | ||
onClose, | ||
top = '100px', | ||
left = '50%', | ||
position = 'absolute', | ||
overlayColor = 'transparent', | ||
}) => { | ||
const [cardinalNumber, setCardinalNumber] = useState(''); | ||
const [customInput, setCustomInput] = useState(''); | ||
const [error, setError] = useState(''); | ||
|
||
const handleSave = () => { | ||
const inputValue = customInput || cardinalNumber; | ||
if (!inputValue.trim()) { | ||
setError('기수를 입력해주세요.'); | ||
return; | ||
} | ||
setError(''); | ||
alert(`새로운 기수: ${inputValue}`); | ||
onClose(); | ||
}; | ||
|
||
return ( | ||
<CommonCardinalModal | ||
isOpen={isOpen} | ||
onClose={onClose} | ||
title="기수 변경" | ||
width="400px" | ||
height="auto" | ||
top={top} | ||
left={left} | ||
position={position} | ||
overlayColor={overlayColor} | ||
showCloseButton={false} | ||
borderBottom | ||
footer={ | ||
<S.FooterWrapper> | ||
<Button | ||
width="80px" | ||
height="45px" | ||
borderRadius="4px" | ||
color="#2f2f2f" | ||
onClick={onClose} | ||
> | ||
Cancel | ||
</Button> | ||
<Button | ||
width="70px" | ||
height="45px" | ||
color="#2f2f2f" | ||
borderRadius="4px" | ||
onClick={handleSave} | ||
> | ||
저장 | ||
</Button> | ||
</S.FooterWrapper> | ||
} | ||
> | ||
<S.ModalContentWrapper> | ||
<S.InputGroup> | ||
<S.StyledInput | ||
type="text" | ||
placeholder="숫자만 입력" | ||
value={cardinalNumber} | ||
onChange={(e) => setCardinalNumber(e.target.value)} | ||
flex={2} | ||
maxWidth="65%" | ||
/> | ||
<S.StyledInput | ||
type="text" | ||
placeholder="직접 입력" | ||
value={customInput} | ||
onChange={(e) => setCustomInput(e.target.value)} | ||
flex={1} | ||
maxWidth="35%" | ||
/> | ||
</S.InputGroup> | ||
<S.ErrorMessage> | ||
*저장되지 않은 숫자는 새로운 기수로 추가됩니다. | ||
</S.ErrorMessage> | ||
</S.ModalContentWrapper> | ||
</CommonCardinalModal> | ||
); | ||
}; | ||
|
||
export default CardinalEditModal; |
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,66 @@ | ||
import React, { useState } from 'react'; | ||
import styled from 'styled-components'; | ||
import Button from '@/components/Button/Button'; | ||
import CheckBox from '@/assets/images/ic_admin_checkbox.svg'; | ||
import UnCheckBox from '@/assets/images/ic_admin_uncheckbox.svg'; | ||
import * as S from '@/styles/admin/cardinal/AdminCardinal.styled'; | ||
import CommonCardinalModal from './CommonCardinalModal'; | ||
|
||
interface CardinalModalProps { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
} | ||
|
||
export const ModalContentWrapper = styled.div` | ||
padding: 20px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
gap: 20px; | ||
`; | ||
|
||
const CardinalModal: React.FC<CardinalModalProps> = ({ isOpen, onClose }) => { | ||
const [isChecked, setIsChecked] = useState(false); | ||
|
||
const handleCheckBoxClick = () => { | ||
setIsChecked((prev) => !prev); | ||
}; | ||
|
||
return ( | ||
<CommonCardinalModal | ||
isOpen={isOpen} | ||
onClose={onClose} | ||
width="400px" | ||
height="auto" | ||
top="20%" | ||
left="40%" | ||
position="absolute" | ||
overlayColor="rgba(0,0,0,0.5)" | ||
showCloseButton | ||
footer={ | ||
<Button width="60px" height="48px" color="#323232" borderRadius="4px"> | ||
저장 | ||
</Button> | ||
} | ||
> | ||
<ModalContentWrapper> | ||
<S.Title>추가할 새로운 기수를 작성해주세요</S.Title> | ||
<S.Input type="text" placeholder="기" /> | ||
<div>활동 시기</div> | ||
<S.FlexRow> | ||
<S.Input type="text" placeholder="년" /> | ||
<S.Input type="text" placeholder="학기" /> | ||
</S.FlexRow> | ||
<S.SvgText onClick={handleCheckBoxClick}> | ||
<img | ||
src={isChecked ? CheckBox : UnCheckBox} | ||
alt={isChecked ? 'checked' : 'unchecked'} | ||
/> | ||
<div> 현재 진행 중 </div> | ||
</S.SvgText> | ||
</ModalContentWrapper> | ||
</CommonCardinalModal> | ||
); | ||
}; | ||
|
||
export default CardinalModal; |
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,72 @@ | ||
import Modal from 'react-modal'; | ||
import * as S from '@/styles/admin/cardinal/AdminCardinal.styled'; | ||
import closeIcon from '@/assets/images/ic_admin_close.svg'; | ||
import { CloseIcon } from './CommonModal'; | ||
|
||
interface CommonCardinalModalProps { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
title?: string; | ||
children: React.ReactNode; | ||
footer?: React.ReactNode; | ||
width?: string; | ||
height?: string; | ||
top?: string; | ||
left?: string; | ||
overlayColor?: string; | ||
showCloseButton?: boolean; | ||
position: 'center' | 'absolute' | 'fixed'; | ||
borderBottom?: boolean; | ||
} | ||
|
||
const CommonCardinalModal: React.FC<CommonCardinalModalProps> = ({ | ||
isOpen, | ||
onClose, | ||
title, | ||
children, | ||
footer, | ||
width = '500px', | ||
height = 'auto', | ||
top = '50%', | ||
left = '50%', | ||
overlayColor = 'rgba(0,0,0,0.5)', | ||
showCloseButton = true, | ||
position = 'center', | ||
borderBottom = false, | ||
}) => { | ||
return ( | ||
<Modal | ||
isOpen={isOpen} | ||
onRequestClose={onClose} | ||
style={{ | ||
overlay: { backgroundColor: 'transparent' }, | ||
content: { inset: 'unset' }, | ||
}} | ||
> | ||
<S.StyledModalOverlay overlayColor={overlayColor}> | ||
<S.StyledModalContent | ||
width={width} | ||
height={height} | ||
top={top} | ||
left={left} | ||
position={position} | ||
> | ||
<S.ModalContainer> | ||
<S.TitleContainer borderBottom={borderBottom}> | ||
<S.TitleText>{title}</S.TitleText> | ||
{showCloseButton && ( | ||
<CloseIcon src={closeIcon} alt="close" onClick={onClose} /> | ||
)} | ||
</S.TitleContainer> | ||
<S.MainContent borderBottom={borderBottom}> | ||
{children} | ||
</S.MainContent> | ||
<S.Footer>{footer}</S.Footer> | ||
</S.ModalContainer> | ||
</S.StyledModalContent> | ||
</S.StyledModalOverlay> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default CommonCardinalModal; |
Oops, something went wrong.