Skip to content

Commit e19c6c9

Browse files
committed
Refactor the settings button in Home and MainView components from an IconButton to a standard button element with explicit styling
1 parent a60a93d commit e19c6c9

4 files changed

Lines changed: 82 additions & 10 deletions

File tree

‎packages/vscode/src/views/panel/frontend/Home/Home.module.scss‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,32 @@
3535
font-weight: 600;
3636
color: var(--vscode-icon-foreground);
3737
}
38+
39+
&__settings {
40+
display: flex;
41+
align-items: center;
42+
justify-content: center;
43+
gap: var(--padding-4px);
44+
cursor: pointer;
45+
text-decoration: none;
46+
background: none;
47+
border: none;
48+
padding: 0;
49+
50+
&__icon-wrapper {
51+
display: flex;
52+
align-items: center;
53+
justify-content: center;
54+
--size: 20px;
55+
width: var(--size);
56+
height: var(--size);
57+
color: var(--vscode-icon-foreground);
58+
}
59+
60+
&:hover .header__settings__icon-wrapper {
61+
animation: rotate 4s linear infinite;
62+
}
63+
}
3864
}
3965

4066
.content {
@@ -139,3 +165,12 @@
139165
color: var(--vscode-descriptionForeground);
140166
}
141167
}
168+
169+
@keyframes rotate {
170+
from {
171+
transform: rotate(0deg);
172+
}
173+
to {
174+
transform: rotate(360deg);
175+
}
176+
}

‎packages/vscode/src/views/panel/frontend/Home/Home.tsx‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,16 @@ export const Home: React.FC<Props> = (props) => {
4646
</div>
4747
<span className={styles['header__text']}>Home</span>
4848
</div>
49-
<IconButton
50-
codicon_icon="settings-gear"
51-
on_click={handle_settings_click}
49+
<button
50+
className={styles['header__settings']}
51+
onClick={handle_settings_click}
5252
title="Settings"
53-
label="Settings"
54-
/>
53+
>
54+
Settings
55+
<span className={styles['header__settings__icon-wrapper']}>
56+
<span className={cn('codicon', 'codicon-settings-gear')} />
57+
</span>
58+
</button>
5559
</div>
5660

5761
<Scrollable>

‎packages/vscode/src/views/panel/frontend/Main/MainView/MainView.module.scss‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,31 @@
6060
flex: 1;
6161
display: flex;
6262
align-items: center;
63+
gap: var(--padding-8px);
6364

6465
&__dropdown {
6566
width: 100%;
6667
}
68+
69+
&__settings {
70+
display: flex;
71+
align-items: center;
72+
justify-content: center;
73+
flex-shrink: 0;
74+
--size: 20px;
75+
width: var(--size);
76+
height: var(--size);
77+
color: var(--vscode-icon-foreground);
78+
cursor: pointer;
79+
text-decoration: none;
80+
background: none;
81+
border: none;
82+
padding: 0;
83+
84+
&:hover > span {
85+
animation: rotate 4s linear infinite;
86+
}
87+
}
6788
}
6889
}
6990

@@ -249,3 +270,12 @@
249270
padding: 0 var(--padding-16px);
250271
position: relative;
251272
}
273+
274+
@keyframes rotate {
275+
from {
276+
transform: rotate(0deg);
277+
}
278+
to {
279+
transform: rotate(360deg);
280+
}
281+
}

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export const MainView: React.FC<Props> = (props) => {
155155

156156
const container_width = container_ref.current.offsetWidth
157157
const header_left_width = header_left_ref.current.offsetWidth
158-
const calculated_width = container_width - header_left_width - 36 - 26 // 26 is for settings button and gap
158+
const calculated_width = container_width - header_left_width - 36 - 20 // 26 is for settings button and gap
159159

160160
set_dropdown_max_width(calculated_width)
161161
}
@@ -314,11 +314,14 @@ export const MainView: React.FC<Props> = (props) => {
314314
/>
315315
)}
316316
</div>
317-
<UiIconButton
318-
codicon_icon="settings-gear"
319-
on_click={() => props.on_quick_action_click('codeWebChat.settings')}
317+
318+
<button
319+
className={styles['header__right__settings']}
320+
onClick={() => props.on_quick_action_click('codeWebChat.settings')}
320321
title="Settings"
321-
/>
322+
>
323+
<span className={cn('codicon', 'codicon-settings-gear')} />
324+
</button>
322325
</div>
323326
</div>
324327
<Scrollable scroll_to_top_key={scroll_to_top_key}>

0 commit comments

Comments
 (0)