7dc98df2b6
Drop the Upgrade-to-Business banner, BE sidebar items (Licenses, Shared Credentials, Edge Configurations, Waiting Room, Update & Rollback), BE branding (BE logo/footer), and BE-only routed views (update-schedules, EdgeAutoCreateScript, WaitingRoom, TimeWindowDisplay/Picker). Prune the featureId/feature/BEFeatureID teaser props from shared components (Switch, SwitchField, BoxSelector, TooltipWithChildren, wizard Option) and fold isBE in useUser while preserving CE authorization semantics. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
49 lines
1.0 KiB
TypeScript
49 lines
1.0 KiB
TypeScript
import clsx from 'clsx';
|
|
|
|
import { AutomationTestingProps } from '@/types';
|
|
|
|
import './Switch.css';
|
|
|
|
import styles from './Switch.module.css';
|
|
|
|
export interface Props extends AutomationTestingProps {
|
|
checked: boolean;
|
|
id: string;
|
|
name: string;
|
|
onChange(checked: boolean, index?: number): void;
|
|
|
|
index?: number;
|
|
className?: string;
|
|
disabled?: boolean;
|
|
}
|
|
|
|
export function Switch({
|
|
name,
|
|
checked,
|
|
id,
|
|
disabled,
|
|
'data-cy': dataCy,
|
|
onChange,
|
|
index,
|
|
className,
|
|
}: Props) {
|
|
return (
|
|
// eslint-disable-next-line jsx-a11y/label-has-associated-control -- accessible text is provided by the parent SwitchField label
|
|
<label
|
|
className={clsx('switch', className, styles.root)}
|
|
data-cy={dataCy}
|
|
aria-checked={checked}
|
|
>
|
|
<input
|
|
type="checkbox"
|
|
name={name}
|
|
id={id}
|
|
checked={checked}
|
|
disabled={disabled}
|
|
onChange={({ target: { checked } }) => onChange(checked, index)}
|
|
/>
|
|
<span className="slider round before:content-['']" />
|
|
</label>
|
|
);
|
|
}
|