Skip to content

Commit 2a728aa

Browse files
committed
Replace custom Checkbox component with native checkbox styled in SCSS and adjust indent guide margin
1 parent 75663a3 commit 2a728aa

2 files changed

Lines changed: 41 additions & 5 deletions

File tree

packages/ui/src/components/editor/panel/Presets/Presets.module.scss

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
background-color: var(--vscode-tree-indentGuidesStroke);
7878
height: 100%;
7979
width: 1px;
80-
margin-right: 11px;
80+
margin-right: 1px;
8181
margin-left: 4px;
8282
}
8383

@@ -128,3 +128,38 @@
128128
flex: 1;
129129
}
130130
}
131+
132+
.checkbox {
133+
appearance: none;
134+
height: 15px;
135+
width: 15px;
136+
color: var(--vscode-checkbox-foreground);
137+
position: relative;
138+
cursor: pointer;
139+
flex-shrink: 0;
140+
margin: 0;
141+
142+
&:focus {
143+
outline: none;
144+
}
145+
146+
&:disabled {
147+
opacity: var(--disabled-opacity);
148+
cursor: default;
149+
}
150+
151+
&::before {
152+
font-family: 'codicon';
153+
content: '\eab2';
154+
font-size: 12px;
155+
position: absolute;
156+
top: 50%;
157+
left: 50%;
158+
transform: translate(-50%, -50%);
159+
opacity: var(--disabled-opacity);
160+
}
161+
162+
&:checked::before {
163+
opacity: 1;
164+
}
165+
}

packages/ui/src/components/editor/panel/Presets/Presets.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import styles from './Presets.module.scss'
22
import { IconButton } from '../IconButton/IconButton'
3-
import { Checkbox } from '../../common/Checkbox'
43
import cn from 'classnames'
54
import { ReactSortable } from 'react-sortablejs'
65
import { Icon } from '../../common/Icon'
@@ -449,12 +448,14 @@ export const Presets: React.FC<Presets.Props> = (props) => {
449448
)}
450449
{preset.chatbot &&
451450
preset_indices_in_group.has(preset.original_index) && (
452-
<Checkbox
451+
<input
452+
type="checkbox"
453+
className={styles.checkbox}
453454
checked={!!preset.is_selected}
454-
on_change={() =>
455+
onChange={() =>
455456
props.on_toggle_selected_preset(preset.name!)
456457
}
457-
on_click={(e) => e.stopPropagation()}
458+
onClick={(e) => e.stopPropagation()}
458459
/>
459460
)}
460461
{preset.chatbot && (

0 commit comments

Comments
 (0)