Skip to content

Commit 7192b52

Browse files
authored
refactor: slim down zoom controls (#1363)
* refactor: slim down zoom controls * refactor: space settings controls consistently
1 parent 950b004 commit 7192b52

File tree

8 files changed

+386
-508
lines changed

8 files changed

+386
-508
lines changed

src/components/buttons/Button.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const buttonVariants = cva(
1919
},
2020
size: {
2121
default: 'min-w-20 h-10 px-4 py-1',
22+
inline: 'h-5 rounded-md px-2 py-1',
2223
xs: 'h-7 rounded-md px-2 py-1',
2324
sm: 'h-9 rounded-md px-2 py-1',
2425
lg: 'h-11 rounded-md px-8',

src/components/fields/Checkbox.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@ export interface ICheckbox {
1313

1414
export const Checkbox: FC<ICheckbox> = (props: ICheckbox) => {
1515
return (
16-
<div className="mb-3 mt-1 text-sm">
17-
<div className="flex items-start">
18-
<div className="flex h-5 items-center">
19-
<input
20-
type="checkbox"
21-
id={props.name}
22-
className="size-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
23-
checked={props.checked}
24-
onChange={props.onChange}
25-
disabled={props.disabled}
26-
/>
27-
</div>
16+
<div className="mt-3 mb-2 text-sm">
17+
<div className="flex items-center">
18+
<input
19+
type="checkbox"
20+
id={props.name}
21+
className="size-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
22+
checked={props.checked}
23+
onChange={props.onChange}
24+
disabled={props.disabled}
25+
/>
2826

2927
<div className="ml-3">
3028
<label

src/components/fields/RadioGroup.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export interface IRadioGroup {
1515

1616
export const RadioGroup: FC<IRadioGroup> = (props: IRadioGroup) => {
1717
return (
18-
<div className={cn('mb-3 mt-1 text-sm', props.className)}>
18+
<div className={cn('mt-3 mb-2 text-sm', props.className)}>
1919
<div className="flex items-start">
20-
<div className="mr-3 py-1">
20+
<div className="mr-3">
2121
<label
2222
htmlFor={props.name}
2323
className="font-medium text-gray-700 dark:text-gray-200"
@@ -37,7 +37,7 @@ export const RadioGroup: FC<IRadioGroup> = (props: IRadioGroup) => {
3737
{props.options.map((item) => {
3838
return (
3939
<div
40-
className="mt-1 flex items-center"
40+
className="flex items-center"
4141
key={`radio_item_${item.value.toLowerCase()}`}
4242
>
4343
<input

src/components/fields/__snapshots__/Checkbox.test.tsx.snap

Lines changed: 16 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/fields/__snapshots__/RadioGroup.test.tsx.snap

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/settings/AppearanceSettings.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ export const AppearanceSettings: FC = () => {
6161
onChange={(evt) => {
6262
updateSetting('theme', evt.target.value as Theme);
6363
}}
64-
className="mb-0"
6564
/>
66-
<div className="flex">
65+
<div className="flex items-center mt-3 mb-2 text-sm">
6766
<label
6867
htmlFor="Zoom"
69-
className="mr-3 content-center font-medium text-sm text-gray-700 dark:text-gray-200"
68+
className="mr-3 content-center font-medium text-gray-700 dark:text-gray-200"
7069
>
7170
Zoom:
7271
</label>
@@ -77,11 +76,11 @@ export const AppearanceSettings: FC = () => {
7776
webFrame.setZoomLevel(zoomPercentageToLevel(zoomPercentage - 10))
7877
}
7978
className="rounded-r-none"
80-
size="xs"
79+
size="inline"
8180
>
8281
-
8382
</Button>
84-
<span className="flex w-16 items-center justify-center rounded-none border border-gray-300 bg-transparent text-sm text-gray-700 dark:text-gray-200">
83+
<span className="flex w-16 h-5 items-center justify-center rounded-none border border-gray-300 bg-transparent text-xs text-gray-700 dark:text-gray-200">
8584
{zoomPercentage.toFixed(0)}%
8685
</span>
8786
<Button
@@ -91,7 +90,7 @@ export const AppearanceSettings: FC = () => {
9190
webFrame.setZoomLevel(zoomPercentageToLevel(zoomPercentage + 10))
9291
}
9392
className="rounded-none"
94-
size="xs"
93+
size="inline"
9594
>
9695
+
9796
</Button>
@@ -100,7 +99,7 @@ export const AppearanceSettings: FC = () => {
10099
onClick={() => webFrame.setZoomLevel(0)}
101100
variant="destructive"
102101
className="rounded-l-none"
103-
size="xs"
102+
size="inline"
104103
>
105104
X
106105
</Button>

0 commit comments

Comments
 (0)