A free, open source, and extensible speech-to-text application that works completely offline.
import React from "react";
import { SettingContainer } from "./SettingContainer";
import { Switch } from "./Switch";
interface ToggleSwitchProps {
checked: boolean;
onChange: (checked: boolean) => void;
disabled?: boolean;
isUpdating?: boolean;
label: string;
description: string;
descriptionMode?: "inline" | "tooltip";
grouped?: boolean;
tooltipPosition?: "top" | "bottom";
}
export const ToggleSwitch: React.FC<ToggleSwitchProps> = ({
checked,
onChange,
disabled = false,
isUpdating = false,
label,
description,
descriptionMode = "tooltip",
grouped = false,
tooltipPosition = "top",
}) => {
return (
<SettingContainer
title={label}
description={description}
descriptionMode={descriptionMode}
grouped={grouped}
disabled={disabled}
tooltipPosition={tooltipPosition}
>
<Switch
checked={checked}
onChange={onChange}
disabled={disabled || isUpdating}
ariaLabel={label}
/>
{isUpdating && (
<div className="absolute inset-0 flex items-center justify-center">
<div className="w-4 h-4 border-2 border-logo-primary border-t-transparent rounded-full animate-spin"></div>
</div>
)}
</SettingContainer>
);
};