|
| 1 | +import React from "react"; |
| 2 | +import LightBulbIcon from "@heroicons/react/solid/LightBulbIcon"; |
| 3 | +import WarningIcon from "@heroicons/react/solid/ExclamationIcon"; |
| 4 | +import ErrorIcon from "@heroicons/react/solid/ExclamationCircleIcon"; |
| 5 | +import InformationCircleIcon from "@heroicons/react/solid/InformationCircleIcon"; |
| 6 | +import { CheckCircleIcon } from "@heroicons/react/solid"; |
| 7 | + |
| 8 | +const themes = { |
| 9 | + info: { |
| 10 | + classes: |
| 11 | + "bg-blue-100 text-blue-800 dark:text-blue-300 dark:bg-blue-200 dark:bg-opacity-20", |
| 12 | + icon: <InformationCircleIcon className="w-5 h-5 mt-1" />, |
| 13 | + }, |
| 14 | + idea: { |
| 15 | + classes: |
| 16 | + "bg-gray-100 text-gray-800 dark:text-gray-300 dark:bg-gray-200 dark:bg-opacity-20", |
| 17 | + icon: <LightBulbIcon className="w-5 h-5 mt-1" />, |
| 18 | + }, |
| 19 | + error: { |
| 20 | + classes: |
| 21 | + "bg-red-200 text-red-900 dark:text-red-200 dark:bg-red-600 dark:bg-opacity-30", |
| 22 | + icon: <ErrorIcon className="w-5 h-5 mt-1" />, |
| 23 | + }, |
| 24 | + default: { |
| 25 | + classes: |
| 26 | + "bg-orange-100 text-orange-800 dark:text-orange-300 dark:bg-orange-200 dark:bg-opacity-20", |
| 27 | + icon: <WarningIcon className="w-5 h-5 mt-1" />, |
| 28 | + }, |
| 29 | + green: { |
| 30 | + classes: |
| 31 | + "bg-green-100 text-green-800 dark:text-green-300 dark:bg-green-200 dark:bg-opacity-20", |
| 32 | + icon: <CheckCircleIcon className="w-5 h-5 mt-1" />, |
| 33 | + }, |
| 34 | +}; |
| 35 | + |
| 36 | +export default function Callout({ children, type = "default", icon }) { |
| 37 | + const theme = themes[type] || themes.default; |
| 38 | + |
| 39 | + return ( |
| 40 | + <div className={`${theme.classes} flex rounded-lg callout mt-6`}> |
| 41 | + <div |
| 42 | + className="py-2 pl-3 pr-2 text-xl select-none" |
| 43 | + style={{ |
| 44 | + fontFamily: |
| 45 | + '"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', |
| 46 | + }} |
| 47 | + > |
| 48 | + {icon || theme.icon} |
| 49 | + </div> |
| 50 | + <div className="py-2 pr-4">{children}</div> |
| 51 | + </div> |
| 52 | + ); |
| 53 | +} |
0 commit comments