Skip to content

Commit

Permalink
Merge pull request #43 from depromeet/refactor/28/convention
Browse files Browse the repository at this point in the history
컨벤션 적용
  • Loading branch information
donghunee authored Jul 16, 2024
2 parents ed8381f + 24f8436 commit fa8ed1e
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/app/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { useAtom } from "jotai";

import Button from "@/component/Button/Button";
import { Modal } from "@/component/common/Modal/Modal";
import { Toast } from "@/component/common/Toast/Toast";
import { Modal } from "@/component/common/Modal";
import { Toast } from "@/component/common/Toast";
import { useModal } from "@/hooks/useModal";
import { useToast } from "@/hooks/useToast";
import { messageAtom } from "@/store/messageAtom.tsx";
Expand Down
6 changes: 2 additions & 4 deletions src/component/common/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Props = {

const DEFAULT_ICON_COLOR = "#000000";

function Icon({ icon, color = DEFAULT_ICON_COLOR, size = "2rem", onClick, ...props }: Props) {
export const Icon = memo(function Icon({ icon, color = DEFAULT_ICON_COLOR, size = "2rem", onClick, ...props }: Props) {
// eslint-disable-next-line import/namespace
const SVGIcon = icons[icon];
const widthRem = typeof size === "number" ? `${size}rem` : size;
Expand All @@ -31,6 +31,4 @@ function Icon({ icon, color = DEFAULT_ICON_COLOR, size = "2rem", onClick, ...pro
{...props}
/>
);
}

export default memo(Icon);
});
1 change: 1 addition & 0 deletions src/component/common/Icon/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Icon } from "@/component/common/Icon/Icon";
2 changes: 1 addition & 1 deletion src/component/common/Modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from "@emotion/react";
import { useEffect, useRef } from "react";

import { Portal } from "@/component/common/Portal/Portal";
import { Portal } from "@/component/common/Portal";
import { useModal } from "@/hooks/useModal";

export function Modal() {
Expand Down
1 change: 1 addition & 0 deletions src/component/common/Modal/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Modal } from "@/component/common/Modal/Modal";
1 change: 1 addition & 0 deletions src/component/common/Portal/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Portal } from "@/component/common/Portal/Portal";
4 changes: 2 additions & 2 deletions src/component/common/Toast/Toast.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from "@emotion/react";

import { Portal } from "@/component/common/Portal/Portal";
import { ToastItem } from "@/component/common/Toast/ToastItem";
import { Portal } from "@/component/common/Portal";
import { ToastItem } from "@/component/common/Toast";
import { useToast } from "@/hooks/useToast";

export function Toast() {
Expand Down
2 changes: 1 addition & 1 deletion src/component/common/Toast/ToastItem.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { css } from "@emotion/react";
import { useRef, useState } from "react";

import { Icon } from "@/component/common/Icon";
import { useToast } from "@/hooks/useToast";
import { ANIMATION } from "@/style/common/animation";
import { toastMap } from "@/style/common/toast";
import { ToastType } from "@/types/toast";
import { collapseToast } from "@/util/toast/collapseToast";
import Icon from "@/component/common/Icon/Icon";

export function ToastItem({ type, content, id, duration = 3000 }: ToastType) {
const { removeToast } = useToast();
Expand Down
2 changes: 2 additions & 0 deletions src/component/common/Toast/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Toast } from "./Toast";
export { ToastItem } from "./ToastItem";
2 changes: 1 addition & 1 deletion src/component/common/appBar/AppBar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from "@emotion/react";
import { useNavigate } from "react-router-dom";

import Icon from "@/component/common/Icon/Icon";
import { Icon } from "@/component/common/Icon";

export type AppBarProps = {
title?: string;
Expand Down

0 comments on commit fa8ed1e

Please sign in to comment.