-
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.
(#2) π Design: κΈ°λ³Έ ν μ€νΈ μμ±
- Loading branch information
Showing
3 changed files
with
90 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.
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,82 @@ | ||
import { Color } from "@/constants/Color" | ||
import Image from 'next/image'; | ||
import XDarkIcon from "@/assets/svg/x-red-dark.svg" | ||
import XLightIcon from "@/assets/svg/x-red-light.svg" | ||
|
||
interface Params { | ||
text: string; | ||
size: number; | ||
color: Color; | ||
} | ||
|
||
export const getTextColor = (color: Color) => { | ||
switch(color){ | ||
case Color.LIGHT: | ||
return "text-grayscale-50"; | ||
case Color.DARK: | ||
return "text-grayscale-50"; | ||
} | ||
} | ||
|
||
export const getBackground = (color: Color) => { | ||
switch(color){ | ||
case Color.LIGHT: | ||
return "bg-grayscale-700"; | ||
case Color.DARK: | ||
return "bg-grayscale-800"; | ||
} | ||
} | ||
|
||
export const getTextFont = (size: number) => { | ||
switch(size) { | ||
case 46: | ||
return "font-medium text-[14pt] " | ||
case 50: | ||
return "font-medium text-[16pt] " | ||
} | ||
} | ||
|
||
export const getDescriptionTextFont = (size:number) => { | ||
switch(size) { | ||
case 46: | ||
return "font-regular text-[12pt] " | ||
case 50: | ||
return "font-regular text-[14pt] " | ||
} | ||
} | ||
|
||
export const getXIcon = (size:number, color: Color) => { | ||
if(color === Color.LIGHT) { | ||
switch(size) { | ||
case 46: | ||
return <Image src={XLightIcon} alt="λ λ-μ°νμ μν X" width={20} height={20}/> | ||
case 50: | ||
return <Image src={XLightIcon} alt="λ λ-μ°νμ μ€ν X" width={20} height={20}/> | ||
} | ||
|
||
}else if(color === Color.DARK) { | ||
switch(size) { | ||
case 46: | ||
return <Image src={XDarkIcon} alt="λ λ-μ§νμ μν X" width={20} height={20}/> | ||
case 50: | ||
return <Image src={XDarkIcon} alt="λ λ-μ§νμ μ€ν X" width={20} height={20}/> | ||
} | ||
|
||
} | ||
} | ||
|
||
/** | ||
* | ||
* @param h: 46 λλ 50 | ||
*/ | ||
const Toast = ({text, size, color}: Params) => { | ||
return ( | ||
<div className={`inline-flex items-center justify-center text-center px-3 py-4 rounded-[12px] ${getBackground(color)} h-${size}`}> | ||
<div className={`${getTextFont(size)} ${getTextColor(color)} `}> | ||
{text} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Toast; |