mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-29 02:54:09 -05:00
* Update typography rule to disallow curly quotes with auto-fix - Reverse typography rule to detect and flag curly quotes instead of straight quotes - Add auto-fixer that converts curly quotes to straight quotes - Fix auto-fixer to properly escape quotes when they match string delimiters * Fix quotation marks in error messages and formatting strings across multiple files - Standardize quotation marks from curly to straight in error messages and string formatting for consistency. - Update various components and utility files to ensure proper string handling and improve readability. * Standardize quotation marks across multiple files - Replace curly quotes with straight quotes in various documentation and code files for consistency and improved readability. - Update error messages, comments, and documentation to ensure uniformity in string formatting. * Standardize month formatting across multiple components - Update month formatting strings from "MMMM 'yy" to "MMMM ''yy" in various components and utility files for consistency. - Ensure uniformity in how months are displayed throughout the application. * Refactor typography rule to enhance curly quote handling - Simplify the error reporting mechanism for curly quotes by creating a shared fix function. - Update test cases to include various curly quote scenarios for improved coverage. - Ensure consistent handling of curly quotes in formatting functions across multiple files. * Refactor typography handling and update tests for curly quotes - Replace curly quotes with their Unicode equivalents in typography rule and related test cases for consistency. - Remove unnecessary eslint-disable comments to improve code clarity. - Ensure proper handling of quotes in arithmetic and utility tests to align with updated typography standards. * Update VRT screenshots Auto-generated by VRT workflow PR: #6454 * Fix: Correct typo in budget cell notification message Co-authored-by: matiss <matiss@mja.lv> * Update VRT screenshots Auto-generated by VRT workflow PR: #6454 * Temporarily disable i18n string extraction workflow --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
89 lines
2.1 KiB
TypeScript
89 lines
2.1 KiB
TypeScript
import React, { type CSSProperties } from 'react';
|
|
|
|
import { css } from '@emotion/css';
|
|
|
|
import { theme } from './theme';
|
|
import { View } from './View';
|
|
|
|
type ToggleProps = {
|
|
id: string;
|
|
isOn: boolean;
|
|
isDisabled?: boolean;
|
|
onToggle?: (isOn: boolean) => void;
|
|
className?: string;
|
|
style?: CSSProperties;
|
|
};
|
|
|
|
export const Toggle = ({
|
|
id,
|
|
isOn,
|
|
isDisabled = false,
|
|
onToggle,
|
|
className,
|
|
style,
|
|
}: ToggleProps) => {
|
|
return (
|
|
<View style={style} className={className}>
|
|
<input
|
|
id={id}
|
|
checked={isOn}
|
|
disabled={isDisabled}
|
|
onChange={e => onToggle?.(e.target.checked)}
|
|
className={css({
|
|
height: 0,
|
|
width: 0,
|
|
visibility: 'hidden',
|
|
})}
|
|
type="checkbox"
|
|
/>
|
|
{/* oxlint-disable-next-line eslint-plugin-jsx-a11y(label-has-associated-control) */}
|
|
<label
|
|
data-toggle-container
|
|
data-on={isOn}
|
|
className={String(
|
|
css({
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'space-between',
|
|
cursor: 'pointer',
|
|
width: '32px',
|
|
height: '16px',
|
|
borderRadius: '100px',
|
|
position: 'relative',
|
|
transition: 'background-color .2s',
|
|
backgroundColor: isOn
|
|
? theme.checkboxToggleBackgroundSelected
|
|
: theme.checkboxToggleBackground,
|
|
}),
|
|
)}
|
|
htmlFor={id}
|
|
>
|
|
<span
|
|
data-toggle
|
|
data-on={isOn}
|
|
className={css(
|
|
{
|
|
content: '" "',
|
|
position: 'absolute',
|
|
top: '2px',
|
|
left: '2px',
|
|
width: '12px',
|
|
height: '12px',
|
|
borderRadius: '100px',
|
|
transition: '0.2s',
|
|
boxShadow: '0 0 2px 0 rgba(10, 10, 10, 0.29)',
|
|
backgroundColor: isDisabled
|
|
? theme.checkboxToggleDisabled
|
|
: '#fff',
|
|
},
|
|
isOn && {
|
|
left: 'calc(100% - 2px)',
|
|
transform: 'translateX(-100%)',
|
|
},
|
|
)}
|
|
/>
|
|
</label>
|
|
</View>
|
|
);
|
|
};
|