This file contains hidden or 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
const DAYS_OF_WEEK = ['일', '월', '화', '수', '목', '금', '토']; | |
const today = dayjs().format('YYYY-MM-DD'); | |
const getColumnTitle = (dateStr: string, index: number) => { | |
const dayOfMonth = dateStr.slice(8); // YYYY-MM-DD 에서 DD에 해당하는 부분 | |
const isToday = dateStr === today; | |
return ( | |
<> | |
<span className={`mr-px ${isToday ? 'p-[2px] bg-red-400 text-white' : 'p-px'} rounded-full`}>{parseInt(dayOfMonth)}</span> |
This file contains hidden or 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
import dayjs from 'dayjs'; | |
import type { ColumnsType } from 'antd/es/table'; | |
/** @returns {string[]} 'YYYY-MM-DD' 형식의 문자열을 요소로 갖는 배열 */ | |
function getWeekDates(startDate: Date): string[] { | |
const dates = []; | |
const startDayOfWeek = startDate.getDay(); // 월요일이라면 1을 반환 | |
for (let i = 0; i < 7; i++) { | |
const date = new Date(startDate); |
This file contains hidden or 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
import { useEffect, useRef } from 'react'; | |
type Props = { | |
id?: number; | |
label?: React.ReactNode; | |
checked: boolean; | |
handleCheckbox: (checked: boolean, id: number) => void; | |
indeterminate?: boolean; | |
}; |
This file contains hidden or 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
interface TableParams { | |
pagination: TablePaginationConfig; | |
sorter?: { | |
field: React.Key; | |
order: 'ascend' | 'descend' | undefined | |
}; | |
} | |
function ProjectList() { | |
const [tableParams, setTableParams] = useState<TableParams>({ |
This file contains hidden or 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
import axios, { AxiosRequestConfig, AxiosInstance } from 'axios'; | |
import { DEMO_BASE_URL } from '../utils/commons'; | |
import { getToken } from '../utils/tokenManagement'; | |
// 인증 정보가 필요하지 않은 instance | |
export const baseAPI = (url: string, options?: AxiosRequestConfig) => { | |
return axios.create({ | |
baseURL: url, | |
headers: { | |
Accept: 'application/json', |
This file contains hidden or 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
import { describe, test, expect } from '@jest/globals'; | |
import { checkEmail, checkPassword } from '../util/authorization/checkPassword'; | |
describe('이메일 주소 유효성 검사', () => { | |
test('@가 없는 이메일 주소는 유효하지 않은 이메일 주소입니다.', () => { | |
const email = 'kimcoding.com'; | |
const result = checkEmail(email); | |
expect(result).toBe(false); | |
}); | |
test('.가 없는 이메일 주소는 유효하지 않은 이메일 주소입니다.', () => { |
This file contains hidden or 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
import { useState, useEffect } from 'react'; | |
function useLocalStorage(key, initialState) { | |
const [state, setState] = useState( | |
() => JSON.parse(window.localStorage.getItem(key)) || initialState | |
); | |
useEffect(() => { | |
window.localStorage.setItem(key, JSON.stringify(state)); | |
}, [key, state]); |
This file contains hidden or 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
import { useContext } from 'react'; | |
import { userContext } from '../App.js'; | |
function useAccessToken() { | |
const { tokens } = useContext(userContext); | |
const accessToken = tokens && tokens.accessToken; | |
return accessToken; | |
} | |
export default useAccessToken; |
NewerOlder