-
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 #166 from Ludo-SMP/feat/create-recruitment
feat: 모집공고 작성 임시저장 기능 구현
- Loading branch information
Showing
64 changed files
with
2,988 additions
and
958 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
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
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,26 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import React from 'react'; | ||
import { LabelForm } from '.'; | ||
|
||
const meta = { | ||
component: LabelForm, | ||
args: { | ||
label: '포지션', | ||
children: React.createElement('input', { placeholder: 'input' }, null), | ||
}, | ||
} satisfies Meta<typeof LabelForm>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
/** 유효하지 않을 경우, 에러메시지를 표시합니다. */ | ||
export const Errors: Story = { | ||
args: { | ||
errors: { | ||
positionIds: { | ||
message: '포지션을 선택해주세요.', | ||
}, | ||
}, | ||
name: 'positionIds', | ||
}, | ||
}; |
Oops, something went wrong.