Skip to content

Commit

Permalink
Merge pull request #20 from peauty/feature/PEAUTY-62
Browse files Browse the repository at this point in the history
[PEAUTY-62] 토스트 컴포넌트 생성
  • Loading branch information
Sieonn authored Nov 26, 2024
2 parents db98314 + 4d86375 commit 96fd614
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 0 deletions.
4 changes: 4 additions & 0 deletions public/svg/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/assets/svg/Check.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as React from "react";
import type { SVGProps } from "react";
const SvgCheck = (props: SVGProps<SVGSVGElement>) => (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 22 20"
{...props}
>
<ellipse cx={11} cy={10} fill="#58C280" rx={10.556} ry={10} />
<path
stroke="#fff"
strokeLinecap="round"
strokeLinejoin="round"
d="m5.412 9.412 4.191 3.53 6.986-5.883"
/>
</svg>
);
export default SvgCheck;
1 change: 1 addition & 0 deletions src/assets/svg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export { default as Arrow } from "./Arrow";
export { default as Bookmark } from "./Bookmark";
export { default as Calendar } from "./Calendar";
export { default as Camera } from "./Camera";
export { default as Check } from "./Check";
export { default as Favicon } from "./Favicon";
export { default as Home } from "./Home";
export { default as Logo } from "./Logo";
Expand Down
26 changes: 26 additions & 0 deletions src/components/global/toast/Toast.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Meta, StoryObj } from "@storybook/react";
import Toast from "./Toast";

const meta: Meta<typeof Toast> = {
title: "Components/Toast",
component: Toast,
parameters: {
layout: "centered",
},
};

export default meta;

type Story = StoryObj<typeof Toast>;

export const Default: Story = {
args: {
children: "등록 성공입니다!",
},
};

export const WithCustomIcon: Story = {
args: {
children: "Custom icon example",
},
};
17 changes: 17 additions & 0 deletions src/components/global/toast/Toast.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import styled from "styled-components";
import { colors } from "../../../style/color";
export const ToastWrapper = styled.div`
background-color: ${colors.grayOpacity300};
padding: 13px 9px;
display: flex;
align-items: center;
justify-content: flex-start;
border-radius: 5px;
`;

export const CheckIcon = styled.div`
margin-right: 9px;
display: flex;
align-items: center;
justify-content: center;
`;
21 changes: 21 additions & 0 deletions src/components/global/toast/Toast.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from "react";
import { ToastWrapper, CheckIcon } from "./Toast.styles";
import { Check } from "../../../assets/svg";
import { Text } from "../texts/Text/Text";

Check failure on line 4 in src/components/global/toast/Toast.tsx

View workflow job for this annotation

GitHub Actions / type-check

Module '"../texts/Text/Text"' has no exported member 'Text'. Did you mean to use 'import Text from "../texts/Text/Text"' instead?

interface ToastProps {
children: React.ReactNode; // children 타입 명시
}

export default function Toast({ children }: ToastProps) {
return (
<ToastWrapper>
<CheckIcon>
<Check width="20px" height="20px" />
</CheckIcon>
<Text typo="body400" color="white">
{children}
</Text>
</ToastWrapper>
);
}
1 change: 1 addition & 0 deletions src/components/global/toast/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./Toast"

0 comments on commit 96fd614

Please sign in to comment.