-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from peauty/feature/PEAUTY-62
[PEAUTY-62] 토스트 컴포넌트 생성
- Loading branch information
Showing
7 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
|
||
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./Toast" |