summaryrefslogtreecommitdiff
path: root/src/core/components/elements/Badge/Badge.jsx
blob: e50cdc783dd2ae97539d2223d66c353864dd5e86 (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
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