Skip to content

Commit d331acd

Browse files
committed
fix(ui-buttons): fix secondary ai-button in firefox
INSTUI-4598
1 parent 51bc68c commit d331acd

File tree

1 file changed

+48
-67
lines changed

1 file changed

+48
-67
lines changed

packages/ui-buttons/src/BaseButton/styles.ts

Lines changed: 48 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -137,96 +137,48 @@ const generateStyle = (
137137
default: {
138138
color: componentTheme.primaryColor,
139139
background: `
140-
linear-gradient(165deg, ${componentTheme.aiBackgroundTopGradientColor} -20.97%, ${componentTheme.aiBackgroundBottomGradientColor} 141.21%) padding-box,
141-
linear-gradient(125deg, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 141.21%) border-box`,
142-
border: 'solid transparent',
140+
linear-gradient(to bottom, ${componentTheme.aiBackgroundTopGradientColor} 0%, ${componentTheme.aiBackgroundBottomGradientColor} 100%) padding-box,
141+
linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%) border-box`,
142+
borderStyle: 'solid',
143+
borderColor: 'transparent',
143144
boxShadow: componentTheme.primaryBoxShadow
144145
},
145-
active: {
146-
background: `
147-
linear-gradient(165deg, ${darken(
148-
componentTheme.aiBackgroundTopGradientColor,
149-
10
150-
)} -20.97%, ${darken(
151-
componentTheme.aiBackgroundBottomGradientColor,
152-
10
153-
)} 141.21%) padding-box,
154-
linear-gradient(125deg, ${darken(
155-
componentTheme.aiBorderTopGradientColor,
156-
10
157-
)} 0%, ${darken(
158-
componentTheme.aiBorderBottomGradientColor,
159-
10
160-
)} 141.21%) border-box`,
161-
border: 'solid transparent',
162-
boxShadow: componentTheme.aiActiveBoxShadow
163-
},
146+
active: {},
164147
hover: {
165148
background: `
166-
linear-gradient(165deg, ${darken(
149+
linear-gradient(to bottom, ${darken(
167150
componentTheme.aiBackgroundTopGradientColor,
168151
10
169-
)} -20.97%, ${darken(
152+
)} 0%, ${darken(
170153
componentTheme.aiBackgroundBottomGradientColor,
171154
10
172-
)} 141.21%) padding-box,
173-
linear-gradient(125deg, ${darken(
155+
)} 100%) padding-box,
156+
linear-gradient(to bottom, ${darken(
174157
componentTheme.aiBorderTopGradientColor,
175158
10
176159
)} 0%, ${darken(
177160
componentTheme.aiBorderBottomGradientColor,
178161
10
179-
)} 141.21%) border-box`,
180-
border: 'solid transparent',
162+
)} 100%) border-box`,
163+
borderStyle: 'solid',
164+
borderColor: 'transparent',
181165
boxShadow: componentTheme.primaryHoverBoxShadow
182166
}
183167
},
184168
'ai-secondary': {
185169
default: {
186-
background: `
187-
linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%) text,
188-
linear-gradient(white) padding-box,
189-
linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} -40%, ${componentTheme.aiBorderBottomGradientColor} 140%) border-box`,
190-
border: 'solid transparent',
191-
boxShadow: componentTheme.primaryBoxShadow,
192-
WebkitTextFillColor: 'transparent'
193-
},
194-
active: {
195-
background: `
196-
linear-gradient(165deg, ${darken(
197-
componentTheme.aiBackgroundTopGradientColor,
198-
10
199-
)} -20.97%, ${darken(
200-
componentTheme.aiBackgroundBottomGradientColor,
201-
10
202-
)} 141.21%) padding-box,
203-
linear-gradient(125deg, ${darken(
204-
componentTheme.aiBorderTopGradientColor,
205-
10
206-
)} 0%, ${darken(
207-
componentTheme.aiBorderBottomGradientColor,
208-
10
209-
)} 141.21%) border-box`,
210-
border: 'solid transparent',
211-
boxShadow: componentTheme.aiActiveBoxShadow
170+
boxShadow: componentTheme.primaryBoxShadow
212171
},
172+
active: {},
213173
hover: {
214174
background: `
215-
linear-gradient(to bottom, ${
216-
componentTheme.aiBorderTopGradientColor
217-
} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%) text,
218-
linear-gradient(165deg, ${lighten(
175+
linear-gradient(to bottom, ${lighten(
219176
componentTheme.aiBackgroundTopGradientColor,
220177
70
221-
)} -20.97%, ${lighten(
178+
)} 0%, ${lighten(
222179
componentTheme.aiBackgroundBottomGradientColor,
223180
70
224-
)} 141.21%) padding-box,
225-
linear-gradient(to bottom, ${
226-
componentTheme.aiBorderTopGradientColor
227-
} -40%, ${componentTheme.aiBorderBottomGradientColor} 140%) border-box`,
228-
border: 'solid transparent',
229-
boxShadow: componentTheme.primaryHoverBoxShadow
181+
)} 100%)`
230182
}
231183
},
232184
primary: withBackground
@@ -420,7 +372,20 @@ const generateStyle = (
420372
},
421373
'&:active > [class$=-baseButton__content]':
422374
colorVariants[color!].active,
423-
'&:hover > [class$=-baseButton__content]': colorVariants[color!].hover
375+
'&:hover > [class$=-baseButton__content]':
376+
colorVariants[color!].hover,
377+
378+
//TODO not the greatest solution. Must be stronger than the same &&& enforcement of <View>
379+
...(color === 'ai-secondary'
380+
? {
381+
'&&&&&&&&&&': {
382+
background: `
383+
linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%)`,
384+
padding: componentTheme.borderWidth,
385+
borderRadius: `calc(${componentTheme.borderRadius} + ${componentTheme.borderWidth})`
386+
}
387+
}
388+
: {})
424389
}
425390
: {
426391
textDecoration: 'none',
@@ -449,6 +414,14 @@ const generateStyle = (
449414

450415
'&:hover': { transform: componentTheme.hoverTransform },
451416

417+
...(color === 'ai-secondary'
418+
? {
419+
border: 'none',
420+
background: 'white',
421+
transition: 'none'
422+
}
423+
: {}),
424+
452425
...sizeVariants[size!].content,
453426
...colorVariants[color!].default,
454427
...shapeVariants[shape!],
@@ -477,7 +450,15 @@ const generateStyle = (
477450
...(isCondensed && {
478451
paddingTop: 0,
479452
paddingBottom: 0
480-
})
453+
}),
454+
...(color === 'ai-secondary'
455+
? {
456+
background: `
457+
linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%)`,
458+
backgroundClip: 'text',
459+
color: 'transparent'
460+
}
461+
: {})
481462
},
482463

483464
iconSVG: {

0 commit comments

Comments
 (0)