Skip to content

Commit 5823cc9

Browse files
committed
Refactor the Dropdown component to replace the footer prop with an info prop displayed directly on the button, and adjust button styling for better spacing
1 parent b646ca9 commit 5823cc9

4 files changed

Lines changed: 14 additions & 24 deletions

File tree

‎packages/ui/src/components/editor/panel/Dropdown/Dropdown.module.scss‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
.button {
66
display: flex;
77
align-items: center;
8-
gap: var(--padding-2px);
8+
gap: var(--padding-4px);
99
padding: 0 var(--padding-5px) 0 var(--padding-7px);
1010
height: 24px;
1111
border: 1px solid var(--vscode-dropdown-border);
@@ -34,6 +34,11 @@
3434
font-size: var(--font-size-13px);
3535
}
3636

37+
&__info {
38+
font-size: var(--font-size-11px);
39+
color: var(--vscode-descriptionForeground);
40+
}
41+
3742
&__icon {
3843
font-size: var(--font-size-14px) !important;
3944
margin-left: var(--padding-2px);
@@ -87,11 +92,4 @@
8792
color: var(--vscode-menu-selectionForeground);
8893
}
8994
}
90-
91-
&__footer {
92-
border-top: 1px dashed var(--vscode-focusBorder);
93-
padding: var(--padding-4px) var(--padding-8px);
94-
color: var(--vscode-descriptionForeground);
95-
font-size: var(--font-size-12px);
96-
}
9795
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const Default = () => {
2323
)
2424
}
2525

26-
export const WithFooter = () => {
26+
export const WithInfo = () => {
2727
const options = [
2828
{ value: 'option1', label: 'Option 1' },
2929
{ value: 'option2', label: 'Option 2' }
@@ -36,7 +36,7 @@ export const WithFooter = () => {
3636
options={options}
3737
selected_value={selected}
3838
on_change={set_selected}
39-
footer="This is a footer."
39+
info="shift+tab"
4040
/>
4141
</div>
4242
)

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

Lines changed: 4 additions & 4 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?: React.ReactNode
16+
info?: string
1717
}
1818
}
1919

@@ -73,6 +73,9 @@ export const Dropdown = <T extends string>(props: Dropdown.Props<T>) => {
7373
<span className={styles.button__label}>
7474
{selected_option ? selected_option.label : 'Select an option'}
7575
</span>
76+
{props.info && (
77+
<span className={styles.button__info}>{props.info}</span>
78+
)}
7679
{is_open ? (
7780
<span
7881
className={cn('codicon', 'codicon-chevron-up', styles.button__icon)}
@@ -102,9 +105,6 @@ export const Dropdown = <T extends string>(props: Dropdown.Props<T>) => {
102105
{option.label}
103106
</div>
104107
))}
105-
{props.footer && (
106-
<div className={styles.menu__footer}>{props.footer}</div>
107-
)}
108108
</div>
109109
)}
110110
</div>

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

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

262-
const dropdown_footer = (
263-
<>
264-
Cycle down: shift+tab
265-
<br />
266-
Cycle up: alt+shift+tab
267-
</>
268-
)
269-
270262
const scroll_to_top_key = `${props.scroll_reset_key}-${
271263
props.home_view_type
272264
}-${
@@ -304,7 +296,7 @@ export const MainView: React.FC<Props> = (props) => {
304296
)}
305297
selected_value={props.web_mode}
306298
on_change={props.on_web_mode_change}
307-
footer={dropdown_footer}
299+
info="shift+tab"
308300
max_width={dropdown_max_width}
309301
/>
310302
)}
@@ -315,7 +307,7 @@ export const MainView: React.FC<Props> = (props) => {
315307
)}
316308
selected_value={props.api_mode}
317309
on_change={props.on_api_mode_change}
318-
footer={dropdown_footer}
310+
info="shift+tab"
319311
max_width={dropdown_max_width}
320312
/>
321313
)}

0 commit comments

Comments
 (0)