Skip to content

Commit 6a0a371

Browse files
committed
Refactor the Dropdown component to accept footer ReactNode instead of footer_text string
1 parent e11208a commit 6a0a371

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎packages/ui/src/components/editor/panel/Dropdown/Dropdown.stories.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const WithFooter = () => {
3636
options={options}
3737
selected_value={selected}
3838
on_change={set_selected}
39-
footer_text="This is a footer."
39+
footer="This is a footer."
4040
/>
4141
</div>
4242
)

‎packages/ui/src/components/editor/panel/Dropdown/Dropdown.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export namespace Dropdown {
1313
selected_value: T
1414
on_change: (value: T) => void
1515
max_width?: number
16-
footer_text?: string
16+
footer?: React.ReactNode
1717
}
1818
}
1919

@@ -102,8 +102,8 @@ export const Dropdown = <T extends string>(props: Dropdown.Props<T>) => {
102102
{option.label}
103103
</div>
104104
))}
105-
{props.footer_text && (
106-
<div className={styles.menu__footer}>{props.footer_text}</div>
105+
{props.footer && (
106+
<div className={styles.menu__footer}>{props.footer}</div>
107107
)}
108108
</div>
109109
)}

‎packages/vscode/src/views/panel/frontend/Main/MainView/MainView.tsx‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,14 @@ export const MainView: React.FC<Props> = (props) => {
232232
configurations: props.configurations
233233
})
234234

235+
const dropdown_footer = (
236+
<>
237+
Cycle down: shift+tab
238+
<br />
239+
Cycle up: alt+shift+tab
240+
</>
241+
)
242+
235243
return (
236244
<div ref={container_ref} className={styles.container}>
237245
<Scrollable>
@@ -262,7 +270,7 @@ export const MainView: React.FC<Props> = (props) => {
262270
)}
263271
selected_value={props.web_mode}
264272
on_change={props.on_web_mode_change}
265-
footer_text="shift+tab cycle down, alt+shift+tab cycle up"
273+
footer={dropdown_footer}
266274
max_width={dropdown_max_width}
267275
/>
268276
)}
@@ -273,7 +281,7 @@ export const MainView: React.FC<Props> = (props) => {
273281
)}
274282
selected_value={props.api_mode}
275283
on_change={props.on_api_mode_change}
276-
footer_text="shift+tab cycle down, alt+shift+tab cycle up"
284+
footer={dropdown_footer}
277285
max_width={dropdown_max_width}
278286
/>
279287
)}

0 commit comments

Comments
 (0)