@@ -6,11 +6,8 @@ import {
6
6
} from "@heroicons/react/24/outline" ;
7
7
import { useState } from "react" ;
8
8
import styled from "styled-components" ;
9
- import {
10
- defaultBorderRadius ,
11
- lightGray ,
12
- vscCommandCenterInactiveBorder ,
13
- } from ".." ;
9
+ import { lightGray } from ".." ;
10
+ import { cn } from "../../util/cn" ;
14
11
import { ToolTip } from "../gui/Tooltip" ;
15
12
16
13
export const OptionDiv = styled . div < {
@@ -47,11 +44,6 @@ export const OptionDiv = styled.div<{
47
44
48
45
export const MAX_HEIGHT_PX = 300 ;
49
46
50
- export const Divider = styled . div `
51
- height: 0.5px;
52
- background-color: ${ vscCommandCenterInactiveBorder } ;
53
- ` ;
54
-
55
47
interface ModelOptionProps {
56
48
children : React . ReactNode ;
57
49
idx : number ;
@@ -64,28 +56,81 @@ interface ModelOptionProps {
64
56
onClickError ?: ( e : any ) => void ;
65
57
}
66
58
67
- const IconBase = styled . div < { $hovered : boolean } > `
68
- width: 1.2em;
69
- height: 1.2em;
70
- cursor: pointer;
71
- padding: 4px;
72
- border-radius: ${ defaultBorderRadius } ;
73
- opacity: ${ ( props ) => ( props . $hovered ? 0.75 : 0 ) } ;
74
- visibility: ${ ( props ) => ( props . $hovered ? "visible" : "hidden" ) } ;
75
-
76
- &:hover {
77
- opacity: 1;
78
- background-color: ${ lightGray } 33;
79
- }
80
- ` ;
59
+ interface IconBaseProps {
60
+ $hovered : boolean ;
61
+ onClick ?: ( e : any ) => void ;
62
+ className ?: string ;
63
+ children ?: React . ReactNode ;
64
+ [ key : string ] : any ;
65
+ }
66
+
67
+ function IconBase ( {
68
+ $hovered,
69
+ onClick,
70
+ className,
71
+ children,
72
+ ...props
73
+ } : IconBaseProps ) {
74
+ return (
75
+ < div
76
+ className = { cn (
77
+ "rounded-default h-[1.2em] w-[1.2em] cursor-pointer p-1" ,
78
+ $hovered ? "visible opacity-75" : "invisible opacity-0" ,
79
+ "hover:bg-lightgray/20 hover:opacity-100" ,
80
+ className ,
81
+ ) }
82
+ onClick = { onClick }
83
+ { ...props }
84
+ >
85
+ { children }
86
+ </ div >
87
+ ) ;
88
+ }
81
89
82
- const StyledCog6ToothIcon = styled ( IconBase ) . attrs ( { as : Cog6ToothIcon } ) `` ;
83
- const StyledArrowTopRightOnSquareIcon = styled ( IconBase ) . attrs ( {
84
- as : ArrowTopRightOnSquareIcon ,
85
- } ) `` ;
86
- const StyledExclamationTriangleIcon = styled ( IconBase ) . attrs ( {
87
- as : ExclamationTriangleIcon ,
88
- } ) `` ;
90
+ const StyledCog6ToothIcon = ( {
91
+ $hovered,
92
+ onClick,
93
+ } : {
94
+ $hovered : boolean ;
95
+ onClick ?: ( e : any ) => void ;
96
+ } ) => (
97
+ < IconBase $hovered = { $hovered } onClick = { onClick } >
98
+ < Cog6ToothIcon />
99
+ </ IconBase >
100
+ ) ;
101
+
102
+ const StyledArrowTopRightOnSquareIcon = ( {
103
+ $hovered,
104
+ onClick,
105
+ } : {
106
+ $hovered : boolean ;
107
+ onClick ?: ( e : any ) => void ;
108
+ } ) => (
109
+ < IconBase $hovered = { $hovered } onClick = { onClick } >
110
+ < ArrowTopRightOnSquareIcon />
111
+ </ IconBase >
112
+ ) ;
113
+
114
+ const StyledExclamationTriangleIcon = ( {
115
+ $hovered,
116
+ onClick,
117
+ className,
118
+ ...props
119
+ } : {
120
+ $hovered : boolean ;
121
+ onClick ?: ( e : any ) => void ;
122
+ className ?: string ;
123
+ [ key : string ] : any ;
124
+ } ) => (
125
+ < IconBase
126
+ $hovered = { $hovered }
127
+ onClick = { onClick }
128
+ className = { className }
129
+ { ...props }
130
+ >
131
+ < ExclamationTriangleIcon />
132
+ </ IconBase >
133
+ ) ;
89
134
90
135
export function Option ( {
91
136
children,
0 commit comments