Skip to content

Commit 0af7294

Browse files
committed
Tailwind migration — autoapprove
1 parent 4fc47eb commit 0af7294

File tree

1 file changed

+14
-50
lines changed

1 file changed

+14
-50
lines changed

webview-ui/src/components/chat/AutoApproveMenu.tsx

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useCallback, useMemo, useState } from "react"
22
import { Trans } from "react-i18next"
33
import { VSCodeCheckbox, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
44

5+
import { cn } from "@/lib/utils"
56
import { vscode } from "@src/utils/vscode"
67
import { useExtensionState } from "@src/context/ExtensionStateContext"
78
import { useAppTranslation } from "@src/i18n/TranslationContext"
@@ -118,23 +119,13 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
118119

119120
return (
120121
<div
121-
style={{
122-
padding: "0 15px",
123-
userSelect: "none",
124-
borderTop: isExpanded
125-
? `0.5px solid color-mix(in srgb, var(--vscode-titleBar-inactiveForeground) 20%, transparent)`
126-
: "none",
127-
overflowY: "auto",
128-
...style,
129-
}}>
122+
className={cn(
123+
"px-[15px] select-none overflow-y-auto",
124+
isExpanded && "border-t-[0.5px] border-vscode-titleBar-inactiveForeground-20",
125+
)}
126+
style={style}>
130127
<div
131-
style={{
132-
display: "flex",
133-
alignItems: "center",
134-
gap: "8px",
135-
padding: isExpanded ? "8px 0" : "8px 0 0 0",
136-
cursor: "pointer",
137-
}}
128+
className={`flex items-center gap-2 cursor-pointer ${isExpanded ? "py-2" : "pt-2 pb-0"}`}
138129
onClick={toggleExpanded}>
139130
<div onClick={(e) => e.stopPropagation()}>
140131
<VSCodeCheckbox
@@ -146,49 +137,22 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
146137
}}
147138
/>
148139
</div>
149-
<div
150-
style={{
151-
display: "flex",
152-
alignItems: "center",
153-
gap: "4px",
154-
flex: 1,
155-
minWidth: 0,
156-
}}>
157-
<span
158-
style={{
159-
color: "var(--vscode-foreground)",
160-
flexShrink: 0,
161-
}}>
162-
{t("chat:autoApprove.title")}
163-
</span>
164-
<span
165-
style={{
166-
color: "var(--vscode-descriptionForeground)",
167-
overflow: "hidden",
168-
textOverflow: "ellipsis",
169-
whiteSpace: "nowrap",
170-
flex: 1,
171-
minWidth: 0,
172-
}}>
140+
<div className="flex items-center gap-1 flex-1 min-w-0">
141+
<span className="text-vscode-foreground flex-shrink-0">{t("chat:autoApprove.title")}</span>
142+
<span className="text-vscode-descriptionForeground overflow-hidden text-ellipsis whitespace-nowrap flex-1 min-w-0">
173143
{enabledActionsList || t("chat:autoApprove.none")}
174144
</span>
175145
<span
176-
className={`codicon codicon-chevron-${isExpanded ? "down" : "right"}`}
177-
style={{
178-
flexShrink: 0,
179-
marginLeft: isExpanded ? "2px" : "-2px",
180-
}}
146+
className={`codicon codicon-chevron-${isExpanded ? "down" : "right"} flex-shrink-0 ${
147+
isExpanded ? "ml-0.5" : "ml-[-2px]"
148+
}`}
181149
/>
182150
</div>
183151
</div>
184152

185153
{isExpanded && (
186154
<div className="flex flex-col gap-2">
187-
<div
188-
style={{
189-
color: "var(--vscode-descriptionForeground)",
190-
fontSize: "12px",
191-
}}>
155+
<div className="text-vscode-descriptionForeground text-xs">
192156
<Trans
193157
i18nKey="chat:autoApprove.description"
194158
components={{

0 commit comments

Comments
 (0)