-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
리니_이경린
committed
Feb 21, 2025
1 parent
5463e51
commit 6c4bc64
Showing
3 changed files
with
49 additions
and
11 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,20 +1,32 @@ | ||
import { forwardRef } from "react"; | ||
|
||
import * as Toast from "@radix-ui/react-toast"; | ||
import classNames from "classnames"; | ||
|
||
import Text from "@/components/ui/Text/Text"; | ||
import styles from "@/components/ui/Toast/Toast.module.scss"; | ||
|
||
export interface ToastProps extends React.HTMLAttributes<HTMLDivElement> { | ||
text: string; | ||
isToast: boolean; | ||
} | ||
|
||
const Toast = forwardRef<HTMLDivElement, ToastProps>(({ text, className, ...props }, ref) => { | ||
return ( | ||
<div ref={ref} className={classNames(styles.Toast, className)} {...props}> | ||
<Text variant="bodyM">{text}</Text> | ||
</div> | ||
); | ||
}); | ||
const ToastComponent = forwardRef<HTMLDivElement, ToastProps>( | ||
({ text, isToast, className, ...props }, ref) => { | ||
return ( | ||
<Toast.Provider swipeDirection="right"> | ||
<Toast.Root | ||
ref={ref} | ||
className={styles.ToastRoot} | ||
open={isToast} | ||
> | ||
<Toast.Title className={classNames(styles.Toast, className)} {...props}> | ||
<Text variant="bodyM">{text}</Text> | ||
</Toast.Title> | ||
</Toast.Root> | ||
<Toast.Viewport className={styles.ToastViewport} /> | ||
</Toast.Provider> | ||
); | ||
}, | ||
); | ||
|
||
export default Toast; | ||
export default ToastComponent; |
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