File size: 860 Bytes
78dd858
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import type { ReactNode } from 'react'

type Variant = 'default' | 'success' | 'warning' | 'error' | 'info'

interface Props {
  children: ReactNode
  variant?: Variant
  className?: string
}

const variantStyles: Record<Variant, string> = {
  default:  'bg-retro-gray text-retro-black',
  success:  'bg-retro-black text-retro-white',
  warning:  'bg-retro-white text-retro-black border-dashed',
  error:    'bg-retro-white text-retro-black font-bold',
  info:     'bg-retro-light text-retro-black',
}

export default function RetroBadge({
  children,
  variant = 'default',
  className = '',
}: Props) {
  return (
    <span
      className={`
        inline-block
        px-2 py-[1px]
        text-retro-xs font-retro
        border border-retro-black
        ${variantStyles[variant]}
        ${className}
      `}
    >
      {children}
    </span>
  )
}