@premieroctet/next-admin
Version:
Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje
36 lines (35 loc) • 1.48 kB
JavaScript
import { jsx, jsxs } from "react/jsx-runtime";
import external_clsx_default from "clsx";
import { useEffect, useState } from "react";
import Checkbox_mjs_default from "./radix/Checkbox.mjs";
const Badge = ({ isActive, onClick, ...props })=>{
const [active, setActive] = useState(isActive);
const handleClick = (e)=>{
setActive((active)=>!active);
onClick?.(e);
};
useEffect(()=>{
setActive(isActive);
}, [
isActive
]);
return /*#__PURE__*/ jsxs("div", {
...props,
className: external_clsx_default("bg-nextadmin-background-default dark:bg-dark-nextadmin-background-emphasis text-nextadmin-content-inverted dark:text-dark-nextadmin-content-subtle ring-nextadmin-border-default dark:ring-dark-nextadmin-border-default bg-nextadmin-background-default dark:bg-dark-nextadmin-background-strong peer flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1 text-sm font-medium ring-1", props.className),
children: [
/*#__PURE__*/ jsx(Checkbox_mjs_default, {
onClick: handleClick,
name: props.name,
id: props.name,
checked: active
}),
/*#__PURE__*/ jsx("label", {
className: "cursor-pointer",
htmlFor: props.name,
children: props.name
})
]
});
};
const components_Badge = Badge;
export { components_Badge as default };