Skip to content

Commit

Permalink
clean: 코드 컨벤션 유지를 위한 패키지 적용
Browse files Browse the repository at this point in the history
- 패키지 yarn berry -> pnpm으로 변경
- prettier tailwind plugin 적용
- lint를 통해 tailwind rule 추가
- unused-var 는 _ 로 사용
  • Loading branch information
raymondanythings committed Jun 26, 2024
1 parent 0130ca6 commit bdb23ca
Show file tree
Hide file tree
Showing 90 changed files with 725 additions and 986 deletions.
16 changes: 14 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extends": [
"next",
"next/core-web-vitals",
"plugin:prettier/recommended",
"plugin:storybook/recommended",
Expand All @@ -8,7 +9,18 @@
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error",
"@typescript-eslint/no-unused-vars": "error",
"react-hooks/rules-of-hooks": "off"
"react-hooks/rules-of-hooks": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
]
}
}
45 changes: 0 additions & 45 deletions .storybook/main.ts

This file was deleted.

16 changes: 0 additions & 16 deletions .storybook/preview.ts

This file was deleted.

5 changes: 1 addition & 4 deletions components/badge/badge-period.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { cn } from '@/lib/client/utils'


// !THINK
export const periods: { [key: string]: string } = {
SIX_MONTHS: '6개월 미만',
Expand All @@ -13,12 +12,10 @@ export const PeriodBadge = ({ period }: { period: string }) => {
return (
<div
className={cn(
'w-fit h-fit rounded-md !text-caption2-medium px-2 py-1 bg-gray-gray50 text-text-sub-gray4f',
'h-fit w-fit rounded-md bg-gray-gray50 px-2 py-1 !text-caption2-medium text-text-sub-gray4f',
)}
>
{periods[period]}
</div>
)
}


2 changes: 1 addition & 1 deletion components/badge/badge-relation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const RelationBadge = ({ relation }: { relation: string }) => {
return (
<div
className={cn(
'w-fit h-fit rounded-md !text-caption2-medium px-2 py-1',
'h-fit w-fit rounded-md px-2 py-1 !text-caption2-medium',
bgColor(relation),
textColor(relation),
)}
Expand Down
20 changes: 10 additions & 10 deletions components/bottomsheet-button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react'
import { MouseEventHandler, useState } from 'react'
import Link from 'next/link'
import { Drawer, DrawerContent } from '../ui/drawer'
import Image from 'next/image'
Expand All @@ -18,27 +18,27 @@ const BottomSheetButton = ({ id, senderWikiId }: BottomSheetButtonProps) => {
})
const [modalOpen, setModalOpen] = useState(false)

const toggleBottomSheet = (e: any) => {
const toggleBottomSheet: MouseEventHandler<HTMLButtonElement> = (e) => {
setBottomSheet((prev) => ({
...prev,
isOpen: !prev.isOpen,
}))
e.stopPropagation()
}

const handleLinkClick = (e: any) => {
const handleLinkClick: MouseEventHandler<HTMLAnchorElement> = (e) => {
if (senderWikiId === null) {
e.preventDefault()
} else {
e.stopPropagation()
}
}

const handleDetailClick = (e: any) => {
const handleDetailClick: MouseEventHandler<HTMLAnchorElement> = (e) => {
e.stopPropagation()
}

const handleWritingClick = (e: any) => {
const handleWritingClick: MouseEventHandler<HTMLButtonElement> = (_) => {
if (senderWikiId === null) {
setModalOpen(true)
} else {
Expand All @@ -52,7 +52,7 @@ const BottomSheetButton = ({ id, senderWikiId }: BottomSheetButtonProps) => {
return (
<>
<button
className="absolute z-20 top-3 right-3"
className="absolute right-3 top-3 z-20"
onClick={toggleBottomSheet}
>
<Image src={menu} alt="menu" />
Expand All @@ -67,14 +67,14 @@ const BottomSheetButton = ({ id, senderWikiId }: BottomSheetButtonProps) => {
}
>
<DrawerContent>
<div className="p-4 flex flex-col text-body3-medium">
<div className="ml-2 flex flex-col my-auto space-y-4 justify-start items-start">
<div className="flex flex-col p-4 text-body3-medium">
<div className="my-auto ml-2 flex flex-col items-start justify-start space-y-4">
<Link
href={`/surveys/questions?wikiId=${senderWikiId}`}
onClick={handleLinkClick}
>
<button
className="flex gap-2 items-center"
className="flex items-center gap-2"
onClick={handleWritingClick}
>
<Image src={pen} alt="pen" />
Expand All @@ -85,7 +85,7 @@ const BottomSheetButton = ({ id, senderWikiId }: BottomSheetButtonProps) => {
href={`/answers?surveyId=${id}`}
onClick={handleDetailClick}
>
<button className="flex gap-2 items-center">
<button className="flex items-center gap-2">
<Image src={eye} alt="eye" />
소개서 자세히 보기
</button>
Expand Down
36 changes: 0 additions & 36 deletions components/carousel/carousel.stories.tsx

This file was deleted.

9 changes: 4 additions & 5 deletions components/carousel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useMemo, useState, useEffect, useCallback, useRef } from 'react'
import React, { useMemo, useState, useEffect, useCallback, useRef } from 'react'
import type { ReactNode, PropsWithChildren } from 'react'
import { UseEmblaCarouselType } from 'embla-carousel-react'
import { EmblaCarouselType } from 'embla-carousel'
Expand All @@ -14,7 +14,6 @@ import {
import { fadeInProps } from '@/variants'
import { cn } from '@/lib/client/utils'


interface CarouselProps<T> {
className?: string
itemClass?: string
Expand Down Expand Up @@ -73,9 +72,9 @@ const Carousel = <T,>({
return (
<LazyMotion features={domAnimation}>
<m.div className={cn(className)} {...fadeInProps}>
<div className="overflow-hidden grow flex flex-col" ref={viewportRef}>
<div className="flex grow flex-col overflow-hidden" ref={viewportRef}>
<div
className="disabled-select flex grow relative h-full"
className="disabled-select relative flex h-full grow"
ref={containerRef}
>
{slides.map((item, index) => (
Expand Down Expand Up @@ -144,7 +143,7 @@ export const DotButton = ({
return (
<m.button
style={{ width: x, backgroundColor }}
className="h-[6px] mx-[3px] flex items-center origin-center rounded-full"
className="mx-[3px] flex h-[6px] origin-center items-center rounded-full"
type="button"
onClick={onClick}
/>
Expand Down
12 changes: 6 additions & 6 deletions components/combobox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ const ComboboxDropdown = forwardRef<HTMLDivElement, CombocoxDropdownProps>(
<div ref={ref} className="relative" onBlur={() => setIsOpen(false)}>
<div
className={cn(
'flex items-center justify-between w-full px-4 py-2 text-left bg-white border border-[#E5E5EC] rounded-md shadow-sm ',
'focus:outline-none focus:border-brand-main-green400 ',
'flex w-full items-center justify-between rounded-md border border-[#E5E5EC] bg-white px-4 py-2 text-left shadow-sm ',
'focus:border-brand-main-green400 focus:outline-none ',
disabled &&
'text-text-sub-gray99 bg-gray-gray50 cursor-not-allowed',
'cursor-not-allowed bg-gray-gray50 text-text-sub-gray99',
!disabled && 'hover:bg-gray-gray50',
)}
onClick={() => setIsOpen(!isOpen)}
Expand All @@ -58,7 +58,7 @@ const ComboboxDropdown = forwardRef<HTMLDivElement, CombocoxDropdownProps>(
strokeWidth={1.5}
stroke="currentColor"
className={cn(
'w-5 h-5 text-text-sub-gray76 duration-300 ease-in-out',
'h-5 w-5 text-text-sub-gray76 duration-300 ease-in-out',
isOpen && 'rotate-180',
)}
>
Expand All @@ -72,7 +72,7 @@ const ComboboxDropdown = forwardRef<HTMLDivElement, CombocoxDropdownProps>(
<AnimatePresence>
{isOpen && (
<motion.div
className="absolute z-10 mt-1 w-full bg-white border border-[#E5E5EC] rounded-md shadow-lg"
className="absolute z-10 mt-1 w-full rounded-md border border-[#E5E5EC] bg-white shadow-lg"
variants={variants}
initial="initial"
animate="animate"
Expand All @@ -82,7 +82,7 @@ const ComboboxDropdown = forwardRef<HTMLDivElement, CombocoxDropdownProps>(
<motion.div
key={option.value}
className={cn(
'px-4 py-2 cursor-pointer select-none text-left',
'cursor-pointer select-none px-4 py-2 text-left',
index === options.length - 1 ? 'rounded-b-md' : '',
selectedOption?.value === option.value && 'font-bold',
!disabled && 'hover:bg-gray-gray50',
Expand Down
11 changes: 4 additions & 7 deletions components/compositions/answers/answer-detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Reason from '@/components/compositions/answers/reason'
interface AnswerDetailProps {
questionTitle: string
questionName: string
answer?: string | number | any
answer?: string | number
reason: string
index: number
value: string | boolean
Expand Down Expand Up @@ -42,17 +42,14 @@ const AnswerDetail = ({
})()
return (
<>
<div className="py-4 px-1 flex flex-col space-y-4 ">
<div className="flex flex-col space-y-4 px-1 py-4 ">
<div className="flex justify-between">
<p className="text-body3-bold">
{index + 1}.{' '}
<span dangerouslySetInnerHTML={{ __html: questionTitle }}></span>
</p>
{onShareClick && (
<button
onClick={onShareClick}
className="shrink-0 self-baseline"
>
<button onClick={onShareClick} className="shrink-0 self-baseline">
<svg
width="20"
height="20"
Expand Down Expand Up @@ -84,7 +81,7 @@ const AnswerDetail = ({
</div>
{answer && (
<div
className="w-fit text-body3-medium px-2 py-1 rounded-md"
className="w-fit rounded-md px-2 py-1 text-body3-medium"
style={answerStyle}
>
{answer}
Expand Down
2 changes: 1 addition & 1 deletion components/compositions/answers/reason/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Reason = ({ reason, ...rest }: ReasonProps) => {
<div
{...rest}
className={cn(
'text-body3-medium bg-bg-gray1 text-text-sub-gray76 px-2 py-4 rounded-md whitespace-pre-wrap',
'whitespace-pre-wrap rounded-md bg-bg-gray1 px-2 py-4 text-body3-medium text-text-sub-gray76',
rest.className,
)}
>
Expand Down
Loading

0 comments on commit bdb23ca

Please sign in to comment.