-
Notifications
You must be signed in to change notification settings - Fork 0
Frontend TsDoc Convention
λ°μμ edited this page Mar 16, 2025
·
1 revision
λͺ¨λ νμ μ νμ
-
μ₯μ
-
types/
μ μλ νμΌ μμ²΄κ° λ μμΈν API λ¬Έμκ° λ¨ - λ³μλͺ λ§μΌλ‘ μ μΆνκΈ° μ΄λ €μ΄ νμ μ κ²½μ° μ‘°κΈ λ μμΈν μ 보λ₯Ό λ°λ‘ νμΈν μ μμ
-
-
λ¨μ
- μ½λκ° λμ΄λμ λΆνΈν μ μμ
- λ°±μλμ λκΈ°νλμ§ μλ κ²½μ° νμ μ΄ λ§€μ° μ΄λ €μμ§
/**
* + μ μ μ±μ©κ΄ μΉμΈ μν
* 1. `review`: κ²ν μ€
* 1. `needSupplement`: κΆν 보좩
* 1. `approved`: νμ©
* 1. `noPermission`: κΆν μμ
**/
export type UserRecruitmentAdminApprovedStatus =
| 'review'
| 'needSupplement'
| 'approved'
| 'noPermission';
/**
* + μ μ μ±μ©κ΄ μν
* 1. `none`:
* 1. `member`: λ©€λ²
* 1. `manager`: λ§€λμ
* 1. `master`: λ§μ€ν°
* 1. `resign`: ν΄μ¬μ
*/
export type UserRecruitmentAdminStatus = 'none' | 'member' | 'manager' | 'master' | 'resign';
/** μ μ μ±μ©κ΄ */
export interface UserRecruitmentAdmin {
/** μ μ μ±μ©κ΄ μλ³μ */
id: number;
/** μ μ μ±μ©κ΄ μ μ μλ³μ */
userId: number;
/** μ μ μ±μ©κ΄ νμ¬ μλ³μ */
recruitmentCompanyId: number;
/** μ μ μ±μ©κ΄ ν΄λν° λ²νΈ */
phone: string;
/** μ μ μ±μ©κ΄ μμ */
department: string;
/** μ μ μ±μ©κ΄ μ§κΈ */
position: string;
/** μ μ μ±μ©κ΄ μΉμΈ μν */
approvedStatus: UserRecruitmentAdminApprovedStatus;
/** μ μ μ±μ©κ΄ μν */
status: UserRecruitmentAdminStatus;
/** μ μ μ±μ©κ΄ λν λ§μ€ν° μ¬λΆ */
isOriginMaster: false;
/** μ μ μ±μ©κ΄ TODO: ? */
isBannerClosed: false;
/** μ μ μ±μ©κ΄ μμ μ¬λΆ */
isDeleted: false;
/** μ μ μ±μ©κ΄ μμ± μκ° */
createdAt: string;
/** μ μ μ±μ©κ΄ μμ μκ° */
updatedAt: string;
/** μ μ μ±μ©κ΄ νμ¬ μ΄λ¦ */
companyName: string;
/** μ μ μ±μ©κ΄ νμ¬κ° μΉμΈλκ³ , μλΉμ€κ° μλμ§ μ¬λΆ */
isCompanyCompleted: boolean;
/** μ μ μ±μ©κ΄ μ±μ©κ΄ κ΄λ¦¬μκ° λ§μ§λ§μΌλ‘ λ³Έ μ±μ© κ³΅κ³ μλ³μ */
lastWatchedRecruitmentNoticeId: number;
}
/** λ‘κ·ΈμΈλ μ μ μ 보 νμ
*/
export interface UserInfoType {
/** μ μ μλ³μ */
id: number;
/** μ μ μ΄λ©μΌ */
email: string;
/** μ μ μμ
λ‘κ·ΈμΈ κ³ μ κ° */
externalId: string | null;
/** μ μ μ±μ©κ΄ μ 보 */
recruitmentAdmin: UserRecruitmentAdmin | null;
}
export const loadloggedInfoAPI = () => axios.get<UserInfoType>('/api/v2/me');
(async () => {
const user = await loadloggedInfoAPI();
// μ μ μ±μ©κ΄ μ 보
// μ μ μ±μ©κ΄ νμ¬κ° μΉμΈλκ³ , μλΉμ€κ° μλμ§ μ¬λΆ
user.recruitmentAdmin.isCompanyCompleted
})()
곡μ©μΌλ‘ μ¬μ©νλ μ»΄ν¬λνΈμλ νμ, κ·Έ μ΄μΈλ μ ν
-
μ₯μ
- μ»΄ν¬λνΈμ μ§μ λ€μ΄κ°μ§ μμλ μ¬μ©νλ λΆλΆμμ λ°λ‘
props
μ λν μ 보λ₯Ό μ μ μμ - ꡬ체μ μΌλ‘ μ€λͺ μ μμ±νλ€λ³΄λ©΄ λλΈ μ²΄ν¬ν μ μμ
- λ§μ½
Stortbook
μ μ¬μ©νλ€λ©΄ μλμ μΌλ‘ μ»΄ν¬λνΈμprops
μ λν μ€λͺ μ΄ κΈ°μ λ¨
- μ»΄ν¬λνΈμ μ§μ λ€μ΄κ°μ§ μμλ μ¬μ©νλ λΆλΆμμ λ°λ‘
-
λ¨μ
- μ»΄ν¬λνΈκ° μ€νλ € λ κΈΈμ΄μ§
interface Props {
/**
* ν΄λμ€λͺ
( `tailwindCss` )
* @default ""
*/
className?: string;
/**
* λ₯κΈκ² μ²λ¦¬ν μ§ μ¬λΆ
* @default false
*/
rounded?: boolean;
/**
* μλ°νλ‘ μ¬μ©ν ν
μ€νΈ
* @default ""
*/
text?: string;
/**
* μλ°νλ‘ μ¬μ©ν ν
μ€νΈμ κΈΈμ΄
* @default ""
*/
overflowTextLength?: number;
/**
* μλ°νλ‘ μ¬μ©ν μμ΄μ½
* @default undefined
*/
icon?: React.ReactNode;
/**
* μλ°νλ‘ μ¬μ©ν μ΄λ―Έμ§ URL
* @default ""
*/
imagePath?: `https://${string}`;
}
/**
* `framer-motion`κ³Ό `tailwindcss`λ₯Ό μ¬μ©νλ κ³΅μ© μλ°ν
* ( μ°μ μμ: `text` > `icon` > `imagePath` )
*
* @link [λμμΈ λ° μμ± μ°Έκ³ - Avatar(Antd)](https://ant.design/components/avatar)
* @example
* <Avatar text="κΉλ
μ" />
* <Avatar className="bg-main-500" icon={<HomeIcon />} />
* <Avatar imagePath="https://avatars.githubusercontent.com/u/63289318?v=4" />
*
* @todo <Image />μ <img /> λΆκΈ°μ²λ¦¬νκΈ°
*/
const Avatar: React.FC<Props> = ({
className = "",
rounded = false,
text = "",
overflowTextLength = 1,
icon,
imagePath = "",
}) => {
return (
<figure></figure>
);
};
export default Avatar;
// μ¬μ©νλ κ³³μμ λ§μ°μ€λ₯Ό μ¬λ¦¬κ±°λ μλμμ±ν λ TsDocμ μμ±ν μ€λͺ
μ΄ μΆλ ₯λ¨
<Avatar imagePath="" />
곡μ©μΌλ‘ μ¬μ©νλ 컀μ€ν ν μλ νμ, κ·Έ μ΄μΈλ μ ν
import { useState } from 'react'
import type { RefObject } from 'react'
import { useEventListener } from '../useEventListener'
/**
* Custom hook that tracks whether a DOM element is being hovered over.
* @template T - The type of the DOM element. Defaults to `HTMLElement`.
* @param {RefObject<T>} elementRef - The ref object for the DOM element to track.
* @returns {boolean} A boolean value indicating whether the element is being hovered over.
* @public
* @see [Documentation](https://usehooks-ts.com/react-hook/use-hover)
* @example
* ```tsx
* const buttonRef = useRef<HTMLButtonElement>(null);
* const isHovered = useHover(buttonRef);
* // Access the isHovered variable to determine if the button is being hovered over.
* ```
*/
export function useHover<T extends HTMLElement = HTMLElement>(
elementRef: RefObject<T>,
): boolean {
const [value, setValue] = useState<boolean>(false)
const handleMouseEnter = () => {
setValue(true)
}
const handleMouseLeave = () => {
setValue(false)
}
useEventListener('mouseenter', handleMouseEnter, elementRef)
useEventListener('mouseleave', handleMouseLeave, elementRef)
return value
}
μ μ ν λ°μ½λ μ΄ν°κ° μλ€λ©΄ μ¬μ©νλκ² μ’μ κ² κ°μ
@deprecated
, @example
λ μ μ©νκ² μ¬μ©ν μ μμ κ² κ°μ
/**
* μ«μ λκ°λ₯Ό λ°μμ λνλ ν¨μ
*
* @example
* addNumber(1, 1); // 2
*
* @link [λ―ΈλμΈν΄](https://miniintern.com)
*
* @see λ€λ₯Έ μ°Έκ³ ν κ²λ€
*
* // μμ΄λ€κ³ μκ°λλ μ»΄ν¬λνΈ/ν¨μ/νμ
λ±μ μμ±ν΄λκ³ ν
μ€νΈνκ³ μμ νλλ° μ¬μ©
* @deprecated
*
* // κΈ°λ³Έ κ°μ΄ μλ κ²½μ° λͺ
μ
* @defaultValue 10
*
* // νμ
μ€ν¬λ¦½νΈλΌμ κ΅³μ΄ νμμμ§ μμκΉ μκ°ν¨
* // λ§€κ°λ³μλ 리ν΄κ°μ λν νμ
μ λ°λ‘ λ§λ€μ΄μ ν¨μ μ체μ νμ
μΌλ‘ μ μ©νλ λ°©μμ΄ μ’μ§ μμκΉ μκ°ν¨
* @params
* @returns
**/
const addNumber = (a: number, b: number) => a + b;