Skip to content

Commit

Permalink
Refactor: 타입 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
y-solb committed Jul 21, 2024
1 parent 55ab445 commit b6efafd
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/containers/portfolio/AssetGridLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import Logo from '@/components/common/Logo'
import Asset from '@/components/asset/Asset'
import { LG_BREAKPOINT, MD_BREAKPOINT } from '@/constants/layout'
import { BreakpointType, UserData } from '@/types'
import { BreakpointType, Portfolio } from '@/types'
import { useEffect, useMemo, useState } from 'react'
import { Layouts, Responsive, WidthProvider } from 'react-grid-layout'
import Link from 'next/link'

const ResponsiveGridLayout = WidthProvider(Responsive)

interface AssetGridLayoutProps {
portfolio: UserData
portfolio: Portfolio
layouts?: Layouts
}

Expand Down
4 changes: 2 additions & 2 deletions src/containers/portfolio/AssetGridLayoutEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
BreakpointType,
CommandType,
ToolType,
UserData,
Portfolio,
} from '@/types'
import { useEffect, useState } from 'react'
import { Layouts, Responsive, WidthProvider } from 'react-grid-layout'
Expand All @@ -22,7 +22,7 @@ import { useRecoilValue } from 'recoil'
const ResponsiveGridLayout = WidthProvider(Responsive)

interface AssetGridLayoutEditorProps {
portfolio: UserData
portfolio: Portfolio
layouts?: Layouts
onAdd: (name: ToolType, value: AssetType['value']) => void
onUpdate: (updatedAsset: AssetType) => void
Expand Down
4 changes: 2 additions & 2 deletions src/containers/portfolio/PortfolioEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
CommandType,
SocialLinks,
ToolType,
UserData,
Portfolio,
} from '@/types'
import React, { useEffect, useState } from 'react'
import { Layouts } from 'react-grid-layout'
Expand Down Expand Up @@ -39,7 +39,7 @@ export default function PortfolioEditor({ username }: PortfolioEditorProps) {
const { data, isLoading } = usePortfolioQuery(username, {
enabled: currentUser?.username === username,
})
const [portfolio, setPortfolio] = useState<UserData | null>(null)
const [portfolio, setPortfolio] = useState<Portfolio | null>(null)
const [socialLinks, setSocialLinks] = useState<SocialLinks | null>(null)
const [layouts, setLayouts] = useState<Layouts>({
lg: [],
Expand Down
4 changes: 2 additions & 2 deletions src/containers/portfolio/ProfileEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SocialLinks, UserData } from '@/types'
import { SocialLinks, Portfolio } from '@/types'
import { useRef } from 'react'
import Image from 'next/image'
import {
Expand All @@ -14,7 +14,7 @@ import EmptyThumbnail from '@/components/common/EmptyThumbnail'
import useImageUpload from '@/hooks/useImageUpload'

interface ProfileEditorProps {
portfolio: UserData
portfolio: Portfolio
socialLinks: SocialLinks
onProfileChange: (name: string, value: string) => void
onSocialLinkChange: (name: string, value: string) => void
Expand Down
40 changes: 20 additions & 20 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export type BreakpointType = 'md' | 'lg'

export type ToolType = 'github' | 'content' | 'image' | 'card'

export type CommandType = 'save' | 'update' | 'delete'
Expand All @@ -10,6 +12,19 @@ export interface BaseAsset<T extends ToolType, V> {
value: V
}

export type AssetType =
| GithubAssetType
| TextAssetType
| ImageAssetType
| CardAssetType

export type GithubAssetType = BaseAsset<'github', GithubValue>
export type TextAssetType = BaseAsset<'content', ContentValue>
export type ImageAssetType = BaseAsset<'image', ImageValue>
export type CardAssetType = BaseAsset<'card', CardValue>

export type AssetValueType = GithubValue | ContentValue | ImageValue | CardValue

interface GithubValue {
githubId: string
}
Expand All @@ -32,28 +47,13 @@ interface CardValue {
description: string
}

export type GithubAssetType = BaseAsset<'github', GithubValue>
export type TextAssetType = BaseAsset<'content', ContentValue>
export type ImageAssetType = BaseAsset<'image', ImageValue>
export type CardAssetType = BaseAsset<'card', CardValue>

export type AssetType =
| GithubAssetType
| TextAssetType
| ImageAssetType
| CardAssetType

export type AssetValueType = GithubValue | ContentValue | ImageValue | CardValue

export type BreakpointType = 'md' | 'lg'

export type AuthInfo = {
export interface AuthInfo {
id: string
username: string
thumbnail: string | null
}

export type SocialLinks = {
export interface SocialLinks {
blogLink: string | null
facebookLink: string | null
githubLink: string | null
Expand All @@ -63,7 +63,7 @@ export type SocialLinks = {
youtubeLink: string | null
}

export type UserData = {
export interface Portfolio {
id: string
username: string
displayName: string
Expand All @@ -74,13 +74,13 @@ export type UserData = {
assets: AssetType[]
}

export type Activity = {
export interface Activity {
date: string
count: number
level: number
}

export type PortfolioItemType = {
export interface PortfolioItemType {
id: string
displayName: string
shortBio: string
Expand Down

0 comments on commit b6efafd

Please sign in to comment.