UNPKG

@wener/console

Version:

Base console UI toolkit

32 lines (31 loc) 1.22 kB
import React from "react"; import classNames from "clsx"; import { DaisyTheme } from "./DaisyTheme.js"; import { getSupportedThemes } from "./getSupportedThemes.js"; import { ThemePreviewCard } from "./ThemePreviewCard.js"; export const ThemeListSelector = ({ className, style, ...props }) => { const [state, update] = DaisyTheme.useThemeState(); const { theme } = state; const setTheme = (v) => { update({ theme: v }); }; return /*#__PURE__*/ React.createElement("div", { className: classNames("flex flex-wrap gap-1 p-2", className), style: style, ...props }, getSupportedThemes().map((v) => /*#__PURE__*/ React.createElement("div", { key: v.value, onClick: () => { setTheme(v.value); }, className: classNames("cursor-pointer rounded border p-1", "hover:border-info", theme === v.value ? "border-primary" : "border-transparent") }, /*#__PURE__*/ React.createElement("div", { "data-theme": v.value, className: "overflow-hidden rounded" }, /*#__PURE__*/ React.createElement(ThemePreviewCard, { title: v.label }))))); }; //# sourceMappingURL=ThemeListSelector.js.map