Skip to content

Commit

Permalink
(#2) πŸ’„ Design: κΈ°λ³Έ ν† μŠ€νŠΈ 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
inaemon committed Jan 18, 2025
1 parent 962d17d commit 6baf580
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/assets/svg/x-red-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/svg/x-red-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions src/components/Global/Toast/DefaultToast.tsx
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;

0 comments on commit 6baf580

Please sign in to comment.