Skip to content

Commit 399108e

Browse files
committed
Enable tooltips on the Switch component by adding a title prop
1 parent 3884b60 commit 399108e

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

packages/ui/src/components/editor/Switch/Switch.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type SwitchProps<T extends string> = {
66
value: T
77
on_change: (value: T) => void
88
options: T[]
9+
title?: string
910
}
1011

1112
export const Switch = <T extends string>(props: SwitchProps<T>) => {
@@ -42,7 +43,7 @@ export const Switch = <T extends string>(props: SwitchProps<T>) => {
4243
}, [props.value])
4344

4445
return (
45-
<div className={styles.container} ref={container_ref}>
46+
<div className={styles.container} ref={container_ref} title={props.title}>
4647
<div className={styles.pill} style={pill_style} />
4748
{props.options.map((option) => (
4849
<div

packages/vscode/src/view/frontend/tabs/home/HomeView/HomeView.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { HorizontalSelector as UiHorizontalSelector } from '@ui/components/edito
77
import { Preset } from '@shared/types/preset'
88
import { EditFormat } from '@shared/types/edit-format'
99
import { EditFormatSelectorVisibility } from '@/view/types/edit-format-selector-visibility'
10-
import { Switch } from '@ui/components/editor/Switch'
10+
import { Switch as UiSwitch } from '@ui/components/editor/Switch'
1111
import { HOME_VIEW_TYPES, HomeViewType } from '@/view/types/home-view-type'
1212
import { TextButton as UiTextButton } from '@ui/components/editor/TextButton'
1313

@@ -169,10 +169,11 @@ export const HomeView: React.FC<Props> = (props) => {
169169
style={{ display: !props.is_visible ? 'none' : undefined }}
170170
>
171171
<div className={styles.top}>
172-
<Switch
172+
<UiSwitch
173173
value={props.home_view_type}
174174
on_change={props.on_home_view_type_change}
175175
options={Object.values(HOME_VIEW_TYPES)}
176+
title="Initialize web chats hands-free or update your files right away"
176177
/>
177178

178179
{props.home_view_type == HOME_VIEW_TYPES.WEB && (

0 commit comments

Comments
 (0)