File size: 847 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import clsx from 'clsx'
import { CheckCircle, Fire, Note, Warning } from 'phosphor-react'
import { ReactNode } from 'react'
import { capitalize } from '~/helpers/strings'
import { S } from '../styles/fontStyles.css'
import { calloutWrapper, label } from './Callout.css'

interface CalloutProps {
  children?: ReactNode
  variant?: 'warning' | 'danger' | 'success' | 'note'
}

const icons = {
  warning: Warning,
  danger: Fire,
  success: CheckCircle,
  note: Note,
}

export const Callout = ({ children, variant = 'warning' }: CalloutProps) => {
  const Icon = icons[variant]

  return (
    <div
      className={calloutWrapper({
        type: variant,
      })}
    >
      <div className={clsx(S, label({ type: variant }))}>
        <Icon size={20} weight="bold" />
        {capitalize(variant)}
      </div>
      {children}
    </div>
  )
}