강의

멘토링

커뮤니티

Inflearn Community Q&A

yho795551490's profile image
yho795551490

asked

Storybooks and UI tests that can be applied directly to practice

IconButton components in TextField and how to manage .svg files

svg를 public 말고 src>assets안에 넣는다면 import를 어떻게해야하나요?

Resolved

Written on

·

250

1

현재는 public에서 아이콘을 가져오는데 assets에 가져올때는 어떻게 하나요?

 

 

import type { Meta, StoryObj } from "@storybook/react";
import { IconButton } from "../../components/IconButton";
const meta = {
  title: "Buttons/IconButton",
  component: IconButton,
  parameters: {
    layout: "centered",
  },
  tags: ["autodocs"],
  argTypes: {
    alt: { control: "text", description: "아이콘의 대체 텍스트" },
    iconPath: {
      control: "text",
      description: "아이콘의 경로",
      defaultValue: "",
    },
    onClick: { action: "clicked", description: "아이콘 클릭 시 호출되는 함수" },
  },
} satisfies Meta<typeof IconButton>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
  args: {
    alt: "아이콘",
    iconPath: "ic-delete-dark.svg",
    onClick: () => {},
  },
};

 

reacttypescripttailwind-cssstorybookui-testing

Answer 2

1

yho79555님의 프로필 이미지
yho79555
Questioner

강의에 있었네요

0

jasonkang님의 프로필 이미지
jasonkang
Instructor

확인 감사합니다!

yho795551490's profile image
yho795551490

asked

Ask a question