diff --git a/components/kern-button/ButtonAsText.tsx b/components/kern-button/ButtonAsText.tsx new file mode 100644 index 0000000..66e5653 --- /dev/null +++ b/components/kern-button/ButtonAsText.tsx @@ -0,0 +1,61 @@ +import { combineClassNames } from "@/submodules/javascript-functions/general"; +import { useMemo } from "react"; + +export type ButtonAsTextProps = { + text: string; + color?: string; + onClick?: () => void; + disabled?: boolean; + iconLeft?: (props: any) => React.ReactNode; + iconRight?: (props: any) => React.ReactNode; + iconColor?: string; + size?: 'small' | 'medium' | 'large'; + className?: string; +} + +export default function ButtonAsText(props: ButtonAsTextProps) { + const classCombined = useMemo(() => combineClassNames( + 'disabled:text-gray-400 disabled:cursor-not-allowed flex items-center space-x-1', + props.className, + props.color ? ( + `text-${props.color}-600 hover:text-${props.color}-900` + ) : ( + 'text-gray-600 hover:text-gray-900' + ) + ), [props.color]); + + return ( + ) +} \ No newline at end of file diff --git a/components/kern-button/IconButton.tsx b/components/kern-button/IconButton.tsx new file mode 100644 index 0000000..58d3280 --- /dev/null +++ b/components/kern-button/IconButton.tsx @@ -0,0 +1,103 @@ +import { combineClassNames } from "@/submodules/javascript-functions/general"; +import { Tooltip } from '@nextui-org/react' +import { IconCheck } from "@tabler/icons-react"; +import { useState } from "react"; + +interface IconButtonProps { + icon: (props: any) => React.ReactNode; + iconColor?: string; + onClick?: (e?: any) => void; + buttonColor?: string; + disabled?: boolean; + keepOpacity?: boolean; + size?: 'small' | 'medium' | 'large'; + tooltip?: string; + tooltipPlacement?: 'top' | 'bottom' | 'left' | 'right'; + confirm?: boolean; + onMouseDown?: (e?: any) => void; + className?: string; +} + +function InnerButton(props: IconButtonProps) { + const [confirmed, setConfirmed] = useState(false); + + return ( + + ) +} + +export default function IconButton(props: IconButtonProps) { + return props.disabled ? ( + + ) : ( + + + + ) +} \ No newline at end of file diff --git a/components/kern-button/KernButton.tsx b/components/kern-button/KernButton.tsx index bc79bcb..f990e2b 100644 --- a/components/kern-button/KernButton.tsx +++ b/components/kern-button/KernButton.tsx @@ -22,6 +22,7 @@ interface KernButtonProps { tooltip?: string; tooltipPlacement?: 'top' | 'bottom' | 'left' | 'right'; confirm?: boolean; + className?: string; } export default function KernButton(props: KernButtonProps) { @@ -44,6 +45,7 @@ export default function KernButton(props: KernButtonProps) { className={ combineClassNames( 'text-sm group flex gap-x-2 items-center rounded-md hover:shadow-sm transition duration-200 ease-in-out disabled:opacity-50 disabled:cursor-not-allowed', + props.className, props.buttonColor ? ( props.solidTheme ? ( `border border-${props.buttonColor}-600 bg-${props.buttonColor}-600 hover:bg-${props.buttonColor}-600 active:bg-${props.buttonColor}-600 active:border-${props.buttonColor}-600` diff --git a/components/kern-button/SaveButton.tsx b/components/kern-button/SaveButton.tsx index 8493c08..e2ee9d1 100644 --- a/components/kern-button/SaveButton.tsx +++ b/components/kern-button/SaveButton.tsx @@ -20,6 +20,7 @@ type SaveButtonProps = { tooltipPlacement?: 'top' | 'bottom' | 'left' | 'right'; confirm?: boolean; warningCue?: any + className?: string; } export default function SaveButton(props: SaveButtonProps) { @@ -47,8 +48,8 @@ export default function SaveButton(props: SaveButtonProps) { const sizeClasses: string = useMemo(() => getSizeClasses(props.size), [props.size]); - const buttonClasses = useMemo(() => combineClassNames("flex gap-x-1 items-center hover:shadow-sm rounded-lg px-2 py-1", disabledClasses, buttonColorClasses, widthClasses, heightClasses, props.warningCue && buttonWarningColorClasses), - [disabledClasses, buttonColorClasses, widthClasses, heightClasses, props.warningCue]); + const buttonClasses = useMemo(() => combineClassNames("flex gap-x-1 items-center hover:shadow-sm rounded-lg px-2 py-1", disabledClasses, buttonColorClasses, widthClasses, heightClasses, props.warningCue && buttonWarningColorClasses, props.className), + [disabledClasses, buttonColorClasses, widthClasses, heightClasses, props.warningCue, props.className]); return (