UNPKG

@helpwave/hightide

Version:

helpwave's component and theming library

97 lines (95 loc) 2.46 kB
// src/components/SortButton.tsx import { ChevronDown, ChevronsUpDown, ChevronUp } from "lucide-react"; // src/components/Button.tsx import clsx from "clsx"; import { jsx, jsxs } from "react/jsx-runtime"; var ButtonSizePaddings = { small: "btn-sm", medium: "btn-md", large: "btn-lg" }; var TextButton = ({ children, disabled = false, color = "neutral", size = "medium", startIcon, endIcon, onClick, className, ...restProps }) => { const colorClasses = { negative: "bg-transparent text-button-text-negative-text", neutral: "bg-transparent text-button-text-neutral-text" }[color]; const iconColorClasses = { negative: "text-button-text-negative-icon", neutral: "text-button-text-neutral-icon" }[color]; return /* @__PURE__ */ jsxs( "button", { onClick: disabled ? void 0 : onClick, disabled: disabled || onClick === void 0, className: clsx( className, { "text-disabled-text": disabled, [clsx(colorClasses, "hover:bg-button-text-hover-background rounded-full")]: !disabled }, ButtonSizePaddings[size] ), ...restProps, children: [ startIcon && /* @__PURE__ */ jsx( "span", { className: clsx({ [iconColorClasses]: !disabled, [`text-disabled-icon`]: disabled }), children: startIcon } ), children, endIcon && /* @__PURE__ */ jsx( "span", { className: clsx({ [iconColorClasses]: !disabled, [`text-disabled-icon`]: disabled }), children: endIcon } ) ] } ); }; // src/components/SortButton.tsx import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime"; var SortButton = ({ children, ascending, color, onClick, ...buttonProps }) => { return /* @__PURE__ */ jsx2( TextButton, { color, onClick: () => onClick(ascending === "descending" ? "ascending" : "descending"), ...buttonProps, children: /* @__PURE__ */ jsxs2("div", { className: "row gap-x-2", children: [ children, ascending === "ascending" ? /* @__PURE__ */ jsx2(ChevronUp, {}) : !ascending ? /* @__PURE__ */ jsx2(ChevronsUpDown, {}) : /* @__PURE__ */ jsx2(ChevronDown, {}) ] }) } ); }; export { SortButton }; //# sourceMappingURL=SortButton.mjs.map