-
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 branch 'dev' into build/setup-chromatic
- Loading branch information
Showing
69 changed files
with
2,600 additions
and
950 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
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 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 |
---|---|---|
@@ -1,54 +1,61 @@ | ||
// react-datepicker를 사용해서 마감날짜 구현 328px, 44px, ex) 24.01.23 | ||
import DatePicker from 'react-datepicker'; | ||
import { useState } from 'react'; | ||
import React, { useState } from 'react'; | ||
import { ControllerRenderProps } from 'react-hook-form'; | ||
|
||
// date-picker | ||
import DatePicker, { ReactDatePicker } from 'react-datepicker'; | ||
import { registerLocale } from 'react-datepicker'; | ||
import ko from 'date-fns/locale/ko'; | ||
import 'react-datepicker/dist/react-datepicker.css'; | ||
import { parseISOString } from '@/utils/date'; | ||
import styled from 'styled-components'; | ||
import { OptionalCreates } from '@/Pages/Studies/CreateRecruitment'; | ||
import { Creates } from '@/Types/studies'; | ||
|
||
export type Props = { | ||
onClick?: () => void; | ||
children?: React.ReactNode; | ||
// onChange?: (event: string) => void; | ||
setForm: (any: OptionalCreates) => void; | ||
useForm: Creates; | ||
value?: string; | ||
type?: string; | ||
name?: string; | ||
maxlength?: number; | ||
id?: string; | ||
formData?: number | string; | ||
ref?: string; | ||
}; | ||
|
||
export const EndDate = ({ useForm }: Props) => { | ||
const [startDateTime, setForms] = useState(new Date()); | ||
|
||
return ( | ||
<DateContainer | ||
value={(useForm.recruitmentEndDateTime = startDateTime.toISOString().slice(0, -5))} | ||
selected={startDateTime} | ||
dateFormat="yy.MM.dd" | ||
onChange={(date: Date) => setForms(date)} | ||
placeholderText="ex)24.01.07" | ||
isClearable={true} | ||
/> | ||
); | ||
}; | ||
|
||
registerLocale('ko', ko); | ||
|
||
interface IFormValues { | ||
recruitmentEndDateTime: string; | ||
} | ||
|
||
interface Props { | ||
defaultValue?: string; | ||
} | ||
|
||
export const EndDate = React.forwardRef<ReactDatePicker<string, boolean>, ControllerRenderProps<IFormValues> & Props>( | ||
({ onChange, name, defaultValue }, ref) => { | ||
const today = new Date(); | ||
const [startDate, setStartDate] = useState<Date>(defaultValue && new Date(defaultValue)); | ||
|
||
return ( | ||
<DateContainer | ||
name={name} | ||
locale="ko" | ||
selected={startDate} | ||
dateFormat="yy.MM.dd" | ||
minDate={today} | ||
onChange={(date) => { | ||
onChange(parseISOString(date)); | ||
if (date instanceof Array) setStartDate(date[1]); | ||
else setStartDate(date); | ||
}} | ||
placeholderText="ex)24.01.07" | ||
isClearable={false} | ||
ref={ref} | ||
shouldCloseOnSelect // 날짜를 선택하면 자동으로 닫힌다 | ||
autoComplete="off" | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
const DateContainer = styled(DatePicker)` | ||
width: 328px; | ||
width: 100%; | ||
height: 24px; | ||
background-color: ${(props) => props.theme.color.gray3}; | ||
align-items: center; | ||
align-self: stretch; | ||
border: 1px solid #cbcdd1; | ||
border-width: 0; | ||
background: ${(props) => props.theme.color.gray1}; | ||
resize: none; | ||
flex: 1 0 0; | ||
margin-top: 10px; | ||
padding-bottom: 10px; | ||
padding-right: 16px; | ||
padding-left: 16px; | ||
&::placeholder { | ||
color: ${(props) => props.theme.color.black2}; | ||
} | ||
`; |
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,34 @@ | ||
import Heading from '@/Components/Heading'; | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
export interface FormSectionProps { | ||
icon?: any; | ||
title?: string; | ||
children: React.ReactNode; | ||
} | ||
export const FormSection = ({ icon, title, children }: FormSectionProps) => { | ||
return ( | ||
<FormSectionWrap> | ||
<Heading type={'Title'} component={'Page'}> | ||
{icon && <AssetContainer>{icon}</AssetContainer>} | ||
{title} | ||
</Heading> | ||
{children} | ||
</FormSectionWrap> | ||
); | ||
}; | ||
|
||
const AssetContainer = styled.image` | ||
padding-right: 12px; | ||
`; | ||
|
||
const FormSectionWrap = styled.section` | ||
display: flex; | ||
flex-direction: column; | ||
margin: 24px 0; | ||
& ~ & { | ||
margin-top: 20px; | ||
} | ||
`; |
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
Oops, something went wrong.