index.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. 'use client'
  2. import classNames from '@/utils/classnames'
  3. export type IndicatorProps = {
  4. color?: 'green' | 'orange' | 'red' | 'blue' | 'yellow' | 'gray'
  5. className?: string
  6. }
  7. type ColorMap = {
  8. green: string
  9. orange: string
  10. red: string
  11. blue: string
  12. yellow: string
  13. gray: string
  14. }
  15. const BACKGROUND_MAP: ColorMap = {
  16. green: 'bg-[#31C48D]',
  17. orange: 'bg-[#FF5A1F]',
  18. red: 'bg-[#F04438]',
  19. blue: 'bg-[#36BFFA]',
  20. yellow: 'bg-[#FDB022]',
  21. gray: 'bg-[#D0D5DD]',
  22. }
  23. const BORDER_MAP: ColorMap = {
  24. green: 'border-[#0E9F6E]',
  25. orange: 'border-[#D03801]',
  26. red: 'border-[#D92D20]',
  27. blue: 'border-[#0BA5EC]',
  28. yellow: 'border-[#F79009]',
  29. gray: 'border-[#98A2B3]',
  30. }
  31. const SHADOW_MAP: ColorMap = {
  32. green: 'shadow-[0_0_5px_-3px_rgba(14,159,110,0.1),0.5px_0.5px_3px_rgba(14,159,110,0.3),inset_1.5px_1.5px_0px_rgba(255,255,255,0.2)]',
  33. orange: 'shadow-[0_0_5px_-3px_rgba(255,90,31,0.2),0.5px_0.5px_3px_rgba(255, 90, 31, 0.3), inset_1.5px_1.5px_0_rgba(255, 255, 255, 0.2)]',
  34. red: 'shadow-[0_0_5px_-3px_rgba(249,112,102,0.1),0.5px_0.5px_3px_rgba(249, 112, 102, 0.2), inset_1.5px_1.5px_0_rgba(255, 255, 255, 0.4)]',
  35. blue: 'shadow-[0_0_5px_-3px_rgba(208, 213, 221, 0.1),0.5px_0.5px_3px_rgba(208, 213, 221, 0.3), inset_1.5px_1.5px_0_rgba(255, 255, 255, 0.2)]',
  36. yellow: 'shadow-[0_0_5px_-3px_rgba(253, 176, 34, 0.1),0.5px_0.5px_3px_rgba(253, 176, 34, 0.3), inset_1.5px_1.5px_0_rgba(255, 255, 255, 0.2)]',
  37. gray: 'shadow-[0_0_5px_-3px_rgba(208, 213, 221, 0.1),0.5px_0.5px_3px_rgba(208, 213, 221, 0.3), inset_1.5px_1.5px_0_rgba(255, 255, 255, 0.2)]',
  38. }
  39. export default function Indicator({
  40. color = 'green',
  41. className = '',
  42. }: IndicatorProps) {
  43. return (
  44. <div className={classNames(
  45. 'w-2 h-2 border border-solid rounded-[3px]',
  46. BACKGROUND_MAP[color],
  47. BORDER_MAP[color],
  48. SHADOW_MAP[color],
  49. className,
  50. )}>
  51. </div>
  52. )
  53. }