diff --git a/components/KernDropdown.tsx b/components/KernDropdown.tsx index 6279d8d..7f4e8d3 100644 --- a/components/KernDropdown.tsx +++ b/components/KernDropdown.tsx @@ -84,6 +84,7 @@ export default function KernDropdown(props: KernDropdownProps) { case "bottom": return "-translate-x-1/2 left-1/2 top-full"; case "left": return "-translate-y-1/2 top-1/2 right-full"; case "right": return "-translate-y-1/2 top-1/2 left-full"; + case "leftBottom": return "top-3/4 right-full"; } }, [props.positionDropdown]); diff --git a/components/SVGIcon.tsx b/components/SVGIcon.tsx index 84dfb63..63d7f17 100644 --- a/components/SVGIcon.tsx +++ b/components/SVGIcon.tsx @@ -1,64 +1,66 @@ import { IconHammer, IconSettingsFilled, IconZoomIn, IconZoomOut } from '@tabler/icons-react'; -import { MemoIconBolt, MemoIconChevronDown, MemoIconCode, MemoIconDotsVertical, MemoIconEdit, MemoIconExternalLink, MemoIconFileInfo, MemoIconFilePencil, MemoIconLoader, MemoIconPlayerPlayFilled, MemoIconPlus, MemoIconSettings, MemoIconShieldCheckFilled, MemoIconShieldFilled, MemoIconSquare, MemoIconSquareCheck, MemoIconTrash } from './kern-icons/icons'; +import { MemoIconBolt, MemoIconChevronDown, MemoIconCode, MemoIconDotsVertical, MemoIconEdit, MemoIconExternalLink, MemoIconFileInfo, MemoIconFilePencil, MemoIconLoader, MemoIconPlayerPlayFilled, MemoIconPlus, MemoIconSettings, MemoIconShieldCheckFilled, MemoIconShieldFilled, MemoIconSquare, MemoIconSquareCheck, MemoIconTag, MemoIconTrash } from './kern-icons/icons'; export const SUPPORTED_ICONS = ['IconCode', 'IconBolt', 'IconSquareCheck', 'IconSquare', 'IconPlayerPlayFilled', 'IconTrash', 'IconExternalLink', 'IconLoader', 'IconFilePencil', 'IconFileInfo', 'IconEdit', 'IconShieldFilled', 'IconShieldCheckFilled', 'IconPlus', 'IconSettings', 'IconSettingsFilled', - 'IconHammer', 'IconZoomIn', 'IconZoomOut' - + 'IconHammer', 'IconZoomIn', 'IconZoomOut', 'IconTag' ] type SVGIconProps = { icon: string, size?: number, strokeWidth?: number, - useFillForIcons?: boolean + useFillForIcons?: boolean, + addClasses?: string } export default function SVGIcon(props: SVGIconProps) { switch (props.icon) { + case 'IconTag': + return case 'IconCode': - return + return case 'IconBolt': - return + return case 'IconSquareCheck': - return + return case 'IconSquare': - return + return case 'IconPlayerPlayFilled': - return + return case 'IconTrash': - return + return case 'IconExternalLink': - return + return case 'IconChevronDown': - return + return case 'IconDotsVertical': - return + return case 'IconLoader': - return + return case 'IconFilePencil': - return + return case 'IconFileInfo': - return + return case 'IconEdit': - return + return case 'IconShieldFilled': - return + return case 'IconShieldCheckFilled': - return + return case 'IconPlus': - return + return case 'IconSettings': - return + return case 'IconSettingsFilled': - return + return case 'IconHammer': - return + return case 'IconZoomIn': - return + return case 'IconZoomOut': - return - default: return + return + default: return } } \ No newline at end of file diff --git a/components/SwitchWithLabel.tsx b/components/SwitchWithLabel.tsx new file mode 100644 index 0000000..b6e386b --- /dev/null +++ b/components/SwitchWithLabel.tsx @@ -0,0 +1,51 @@ +import { combineClassNames } from "@/submodules/javascript-functions/general"; +import { Switch } from "@headlessui/react"; +import { Tooltip } from "@nextui-org/react"; +import { useMemo } from "react"; +import { MemoIconAlertCircle, MemoIconAlertTriangle } from "./kern-icons/icons"; + + +type Props = { + checked: boolean; + onChange: () => void; + label: string; + colorLabel?: string; + colorActive?: string; + colorInactive?: string; + addClassesGroup?: string; + tooltip?: string; +} + +export default function SwitchWithLabel(props: Props) { + + const finalColorActive = props.colorActive || 'bg-green-600'; + const finalColorInactive = props.colorInactive || 'bg-gray-200'; + const finalColorLabel = props.colorLabel || 'text-gray-700'; + + const tooltip = useMemo(() => props.tooltip ? : null, [props.tooltip]) + + return + + {props.label} + +
+ + + {tooltip} +
+
+} \ No newline at end of file diff --git a/types/dropdown.ts b/types/dropdown.ts index 75a7fb6..cef95d6 100644 --- a/types/dropdown.ts +++ b/types/dropdown.ts @@ -89,7 +89,7 @@ export type KernDropdownProps = { fontSizeClass?: string; filteredOptions?: (option: string) => void; ignoreDisabledForSearch?: boolean; - positionDropdown?: "top" | "bottom" | "left" | "right"; + positionDropdown?: "top" | "bottom" | "left" | "right" | "leftBottom"; scrollAfterNOptions?: number; dropdownAdd?: JSX.Element[]; forceOverwriteOpen?: boolean;