From 4838df315931bb883f704ec3e1abe2685f296cdf Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Sat, 22 Apr 2023 19:52:26 +0800 Subject: 😀 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/components/Callout.tsx | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 docs/components/Callout.tsx (limited to 'docs/components/Callout.tsx') diff --git a/docs/components/Callout.tsx b/docs/components/Callout.tsx new file mode 100644 index 0000000..d284bae --- /dev/null +++ b/docs/components/Callout.tsx @@ -0,0 +1,55 @@ +import React, { ReactElement, ReactNode } from "react"; +import { + LightBulbIcon, + ExclamationIcon, + ExclamationCircleIcon, + InformationCircleIcon, +} from "@heroicons/react/solid"; + +const THEMES = { + info: { + classes: + "bg-blue-100 text-blue-800 dark:text-blue-300 dark:bg-blue-200 dark:bg-opacity-10", + icon: , + }, + idea: { + classes: + "bg-gray-100 text-gray-800 dark:text-gray-300 dark:bg-gray-200 dark:bg-opacity-10", + icon: , + }, + error: { + classes: + "bg-red-200 text-red-900 dark:text-red-200 dark:bg-red-600 dark:bg-opacity-30", + icon: , + }, + default: { + classes: + "bg-orange-100 text-orange-800 dark:text-orange-300 dark:bg-orange-200 dark:bg-opacity-10", + icon: , + }, +}; + +export default function Callout({ + children, + type = "default", + icon, +}: { + children: ReactNode; + type: keyof typeof THEMES; + icon?: ReactElement; +}) { + return ( +
+
+ {icon || THEMES[type].icon} +
+
{children}
+
+ ); +} -- cgit v1.2.3-70-g09d2