1
1
import CheckCircleOutlined from "@mui/icons-material/CheckCircleOutlined" ;
2
- import { css , useTheme } from "@emotion/react" ;
3
- import { type HTMLAttributes , type PropsWithChildren , type FC } from "react" ;
2
+ import { css , type Interpolation , type Theme , useTheme } from "@emotion/react" ;
3
+ import { type FC , type HTMLAttributes , type PropsWithChildren } from "react" ;
4
4
import { MONOSPACE_FONT_FAMILY } from "theme/constants" ;
5
5
import { DisabledBadge , EnabledBadge } from "components/Badges/Badges" ;
6
6
@@ -107,42 +107,16 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
107
107
type OptionConfigProps = HTMLAttributes < HTMLDivElement > & { isSource : boolean } ;
108
108
109
109
// OptionConfig takes a isSource bool to indicate if the Option is the source of the configured value.
110
- export const OptionConfig = ( { isSource, ...attrs } : OptionConfigProps ) => {
111
- const theme = useTheme ( ) ;
112
- const borderColor = isSource
113
- ? theme . experimental . roles . active . outline
114
- : theme . palette . divider ;
115
-
110
+ export const OptionConfig : FC < OptionConfigProps > = ( { isSource, ...attrs } ) => {
116
111
return (
117
112
< div
118
113
{ ...attrs }
119
- css = { [
120
- {
121
- fontSize : 13 ,
122
- fontFamily : MONOSPACE_FONT_FAMILY ,
123
- fontWeight : 600 ,
124
- backgroundColor : theme . palette . background . paper ,
125
- display : "inline-flex" ,
126
- alignItems : "center" ,
127
- borderRadius : 4 ,
128
- padding : 6 ,
129
- lineHeight : 1 ,
130
- gap : 6 ,
131
- border : `1px solid ${ borderColor } ` ,
132
- } ,
133
- isSource
134
- ? {
135
- "& .OptionConfigFlag" : {
136
- background : theme . experimental . roles . active . fill ,
137
- } ,
138
- }
139
- : undefined ,
140
- ] }
114
+ css = { [ styles . configOption , isSource && styles . sourceConfigOption ] }
141
115
/>
142
116
) ;
143
117
} ;
144
118
145
- export const OptionConfigFlag = ( props : HTMLAttributes < HTMLDivElement > ) => {
119
+ export const OptionConfigFlag : FC < HTMLAttributes < HTMLDivElement > > = ( props ) => {
146
120
const theme = useTheme ( ) ;
147
121
148
122
return (
@@ -163,6 +137,28 @@ export const OptionConfigFlag = (props: HTMLAttributes<HTMLDivElement>) => {
163
137
} ;
164
138
165
139
const styles = {
140
+ configOption : ( theme ) => ( {
141
+ fontSize : 13 ,
142
+ fontFamily : MONOSPACE_FONT_FAMILY ,
143
+ fontWeight : 600 ,
144
+ backgroundColor : theme . palette . background . paper ,
145
+ display : "inline-flex" ,
146
+ alignItems : "center" ,
147
+ borderRadius : 4 ,
148
+ padding : 6 ,
149
+ lineHeight : 1 ,
150
+ gap : 6 ,
151
+ border : `1px solid ${ theme . palette . divider } ` ,
152
+ } ) ,
153
+
154
+ sourceConfigOption : ( theme ) => ( {
155
+ border : `1px solid ${ theme . experimental . roles . active . fill . outline } ` ,
156
+
157
+ "& .OptionConfigFlag" : {
158
+ background : theme . experimental . roles . active . fill . solid ,
159
+ } ,
160
+ } ) ,
161
+
166
162
option : css `
167
163
font-size : 14px ;
168
164
font-family : ${ MONOSPACE_FONT_FAMILY } ;
@@ -173,4 +169,4 @@ const styles = {
173
169
padding : 16px ;
174
170
}
175
171
` ,
176
- } ;
172
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments