-
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 feat/create-study
- Loading branch information
Showing
89 changed files
with
4,420 additions
and
1,306 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,24 @@ | ||
name: Unit Tests | ||
on: | ||
push: | ||
branches: | ||
- dev | ||
pull_request: | ||
workflow_dispatch: | ||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Enable yarn | ||
run: corepack enable | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .node-version | ||
cache: yarn | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Run unit tests | ||
run: yarn test |
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 @@ | ||
v20.10.0 |
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,13 @@ | ||
export default { | ||
testEnvironment: 'jsdom', | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
moduleNameMapper: { | ||
'^.+\\.svg$': 'jest-svg-transformer', | ||
'\\.(css|less|sass|scss)$': 'identity-obj-proxy', | ||
'^@/(.*)$': '<rootDir>/src/$1', | ||
}, | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'], | ||
moduleDirectories: ['node_modules', '<rootDir>'], | ||
}; |
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 @@ | ||
import '@testing-library/jest-dom'; |
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", | ||
"preview": "vite preview", | ||
"start:windows": "set HOST=local.ludoapi.store &&yarn dev", | ||
"test": "jest", | ||
"storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build" | ||
}, | ||
|
@@ -20,6 +21,7 @@ | |
"@types/react-datepicker": "^4.19.5", | ||
"@types/styled-components": "^5.1.34", | ||
"axios": "^1.6.7", | ||
"date-fns": "^3.6.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-import-resolver-typescript": "^3.6.1", | ||
"eslint-plugin-prettier": "^5.1.2", | ||
|
@@ -50,9 +52,13 @@ | |
"@storybook/react": "^8.0.8", | ||
"@storybook/react-vite": "^8.0.8", | ||
"@storybook/test": "^8.0.8", | ||
"@testing-library/jest-dom": "^6.4.2", | ||
"@testing-library/react": "^15.0.2", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^20.11.10", | ||
"@types/react": "^18.2.43", | ||
"@types/react-dom": "^18.2.17", | ||
"@types/uuid": "^9.0.8", | ||
"@typescript-eslint/eslint-plugin": "^6.14.0", | ||
"@typescript-eslint/parser": "^6.14.0", | ||
"@vitejs/plugin-react": "^4.2.1", | ||
|
@@ -61,17 +67,27 @@ | |
"eslint-plugin-react-refresh": "^0.4.5", | ||
"eslint-plugin-storybook": "^0.8.0", | ||
"husky": "^8.0.3", | ||
"identity-obj-proxy": "^3.0.0", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"jest-styled-components": "^7.2.0", | ||
"jest-svg-transformer": "^1.0.0", | ||
"msw-storybook-addon": "^2.0.0", | ||
"prettier": "^3.2.5", | ||
"storybook": "^8.0.8", | ||
"storybook-addon-remix-react-router": "^3.0.0", | ||
"ts-jest": "^29.1.2", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.2.2", | ||
"vite": "^5.0.8", | ||
"vite-plugin-mkcert": "^1.17.3", | ||
"vite-plugin-svgr": "^4.2.0" | ||
}, | ||
"msw": { | ||
"workerDirectory": [ | ||
"src/Mocks" | ||
"src/Mocks", | ||
"public" | ||
] | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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}; | ||
} | ||
`; |
Oops, something went wrong.