summaryrefslogtreecommitdiff
path: root/src/core/components/elements/Badge/Badge.jsx
blob: 5d8ebd1c5f7bd5e7e5e5ae71c4a411f72f8fb43d (plain)
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
const Badge = ({ 
  children, 
  type, 
  ...props 
}) => {
  return (
    <div 
      { ...props }
      className={`${badgeStyle(type)} ${props?.className}`}
    >
      { children }
    </div>
  )
}

Badge.defaultProps = {
  className: ''
}

const badgeStyle = (type) => {
  let className = ['rounded px-1 text-[11px]']
  switch (type) {
    case 'solid-red':
      className.push('bg-red_r-11 text-white')
      break
    case 'light':
      className.push('bg-gray_r-4 text-gray_r-11')
      break
  }
  return className.join(' ')
}

export default Badge