Skip to content

Commit fe66494

Browse files
committed
Clean up SelectDropdown component
1 parent fbb5cfc commit fe66494

File tree

1 file changed

+5
-26
lines changed

1 file changed

+5
-26
lines changed

webview-ui/src/components/ui/select-dropdown.tsx

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from "react"
2+
import { CaretUpIcon } from "@radix-ui/react-icons"
23

34
import { cn } from "@/lib/utils"
45

@@ -36,7 +37,6 @@ export interface SelectDropdownProps {
3637
contentClassName?: string
3738
sideOffset?: number
3839
align?: "start" | "center" | "end"
39-
shouldShowCaret?: boolean
4040
placeholder?: string
4141
shortcutText?: string
4242
}
@@ -53,7 +53,6 @@ export const SelectDropdown = React.forwardRef<React.ElementRef<typeof DropdownM
5353
contentClassName = "",
5454
sideOffset = 4,
5555
align = "start",
56-
shouldShowCaret = true,
5756
placeholder = "",
5857
shortcutText = "",
5958
},
@@ -83,34 +82,14 @@ export const SelectDropdown = React.forwardRef<React.ElementRef<typeof DropdownM
8382
disabled={disabled}
8483
title={title}
8584
className={cn(
86-
"inline-flex items-center gap-1 relative whitespace-nowrap rounded pr-1.5 py-1.5 text-xs outline-none focus-visible:ring-2 focus-visible:ring-vscode-focusBorder",
85+
"w-full min-w-0 max-w-full inline-flex items-center gap-1 relative whitespace-nowrap pr-1.5 py-1.5 text-xs outline-none",
8786
"bg-transparent border-none text-vscode-foreground w-auto",
88-
disabled ? "opacity-50 cursor-not-allowed" : "opacity-80 cursor-pointer hover:opacity-100",
87+
disabled ? "opacity-50 cursor-not-allowed" : "opacity-80 hover:opacity-100 cursor-pointer",
8988
triggerClassName,
90-
)}
91-
style={{
92-
width: "100%", // Take full width of parent.
93-
minWidth: "0",
94-
maxWidth: "100%",
95-
}}>
96-
{shouldShowCaret && (
97-
<div className="pointer-events-none opacity-80 flex-shrink-0">
98-
<svg
99-
fill="none"
100-
height="10"
101-
stroke="currentColor"
102-
strokeLinecap="round"
103-
strokeLinejoin="round"
104-
strokeWidth="2"
105-
viewBox="0 0 24 24"
106-
width="10">
107-
<polyline points="18 15 12 9 6 15" />
108-
</svg>
109-
</div>
110-
)}
89+
)}>
90+
<CaretUpIcon className="pointer-events-none opacity-80 flex-shrink-0 size-3" />
11191
<span className="truncate">{displayText}</span>
11292
</DropdownMenuTrigger>
113-
11493
<DropdownMenuContent
11594
align={align}
11695
sideOffset={sideOffset}

0 commit comments

Comments
 (0)