Skip to content

Commit 1e64240

Browse files
v1.21.0 (#54)
* Adds disabled flag for switch with label * Long emails table fix --------- Co-authored-by: Lina <[email protected]>
1 parent 13a6e12 commit 1e64240

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

components/SwitchWithLabel.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { combineClassNames } from "@/submodules/javascript-functions/general";
22
import { Switch } from "@headlessui/react";
33
import { Tooltip } from "@nextui-org/react";
44
import { useMemo } from "react";
5-
import { MemoIconAlertCircle, MemoIconAlertTriangle } from "./kern-icons/icons";
5+
import { MemoIconAlertTriangle } from "./kern-icons/icons";
66

77

88
type Props = {
@@ -14,17 +14,17 @@ type Props = {
1414
colorInactive?: string;
1515
addClassesGroup?: string;
1616
tooltip?: string;
17+
disabled?: boolean;
1718
}
1819

1920
export default function SwitchWithLabel(props: Props) {
20-
2121
const finalColorActive = props.colorActive || 'bg-green-600';
2222
const finalColorInactive = props.colorInactive || 'bg-gray-200';
2323
const finalColorLabel = props.colorLabel || 'text-gray-700';
2424

2525
const tooltip = useMemo(() => props.tooltip ? <Tooltip content={props.tooltip} color="invert" placement="top"><MemoIconAlertTriangle className="w-6 h-6" /></Tooltip> : null, [props.tooltip])
2626

27-
return <Switch.Group as="div" className={combineClassNames("flex items-center justify-between", props.addClassesGroup)}>
27+
return <Switch.Group as="div" className={combineClassNames("flex items-center justify-between disabled-within:opacity-50 disabled-within:cursor-not-allowed", props.addClassesGroup)}>
2828
<Switch.Description as="span" className={`font-medium ${finalColorLabel}`}>
2929
{props.label}
3030
</Switch.Description>
@@ -34,8 +34,9 @@ export default function SwitchWithLabel(props: Props) {
3434
onChange={props.onChange}
3535
className={combineClassNames(
3636
props.checked ? finalColorActive : finalColorInactive,
37-
'relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2'
37+
'relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer disabled:cursor-not-allowed rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2'
3838
)}
39+
disabled={props.disabled}
3940
>
4041
<span
4142
aria-hidden="true"

components/kern-table/CellComponents.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ function EmailCell({ user }) {
302302
return (
303303
<div className="flex flex-row items-center">
304304
{user.sso_provider ? <Tooltip content={"SSO User via " + user.sso_provider} color="invert">
305-
<span className="text-blue-700">{user.email}*</span></Tooltip> : <span>{user.email}</span>
305+
<span className="text-blue-700 truncate max-w-xs">{user.email}*</span></Tooltip> : <Tooltip content={user.email} color="invert" className="cursor-auto">
306+
<span className="truncate max-w-xs">{user.email}</span>
307+
</Tooltip>
306308
}
307309
</div>
308310
)

0 commit comments

Comments
 (0)