-
Notifications
You must be signed in to change notification settings - Fork 239
feat: add Run All Phases toggle to wizard and resize modal #507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import React from 'react'; | ||
| import type { Theme } from '../../types'; | ||
|
|
||
| export interface ToggleSwitchProps { | ||
| /** Whether the toggle is on */ | ||
| checked: boolean; | ||
| /** Callback when the toggle state changes */ | ||
| onChange: (checked: boolean) => void; | ||
| /** The current theme */ | ||
| theme: Theme; | ||
| /** Optional aria-label for accessibility */ | ||
| ariaLabel?: string; | ||
| /** Whether the toggle is disabled */ | ||
| disabled?: boolean; | ||
| } | ||
|
|
||
| /** | ||
| * A reusable toggle switch (pill-style) with consistent styling. | ||
| * Matches the design used in SettingsModal and other toggle UIs. | ||
| */ | ||
| export function ToggleSwitch({ | ||
| checked, | ||
| onChange, | ||
| theme, | ||
| ariaLabel, | ||
| disabled = false, | ||
| }: ToggleSwitchProps): React.ReactElement { | ||
| return ( | ||
| <button | ||
| onClick={(e) => { | ||
| e.stopPropagation(); | ||
| if (!disabled) onChange(!checked); | ||
| }} | ||
| className={`relative w-10 h-5 rounded-full transition-colors flex-shrink-0 ${ | ||
| disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer' | ||
| }`} | ||
| style={{ | ||
| backgroundColor: checked ? theme.colors.accent : theme.colors.bgActivity, | ||
| }} | ||
| role="switch" | ||
| aria-checked={checked} | ||
| aria-label={ariaLabel} | ||
| disabled={disabled} | ||
| > | ||
|
Comment on lines
+29
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add explicit keyboard focus hooks required by renderer component guidelines. On Line 29, this interactive control is focusable but currently lacks Suggested update export function ToggleSwitch({
checked,
onChange,
theme,
ariaLabel,
disabled = false,
}: ToggleSwitchProps): React.ReactElement {
+ const [isFocused, setIsFocused] = React.useState(false);
+
return (
<button
type="button"
+ tabIndex={disabled ? -1 : 0}
+ onFocus={() => setIsFocused(true)}
+ onBlur={() => setIsFocused(false)}
onClick={(e) => {
e.stopPropagation();
if (!disabled) onChange(!checked);
}}
className={`relative w-10 h-5 rounded-full transition-colors flex-shrink-0 ${
disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'
- }`}
+ } ${isFocused ? 'ring-2 ring-offset-2' : ''}`}
style={{
backgroundColor: checked ? theme.colors.accent : theme.colors.bgActivity,
}}
role="switch"
aria-checked={checked}
aria-label={ariaLabel}
disabled={disabled}
>As per coding guidelines, 🤖 Prompt for AI Agents |
||
| <span | ||
| className={`absolute left-0 top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${ | ||
| checked ? 'translate-x-5' : 'translate-x-0.5' | ||
| }`} | ||
| /> | ||
| </button> | ||
| ); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.