MCPcopy Create free account
hub / github.com/StevenLyt/mapf-visualizer / gradientStyles

Function gradientStyles

src/components/MKButton/MKButtonRoot.js:151–206  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149
150 // styles for the button with variant="gradient"
151 const gradientStyles = () => {
152 // background value
153 const backgroundValue =
154 color === "white" || !gradients[color]
155 ? white.main
156 : linearGradient(gradients[color].main, gradients[color].state);
157
158 // boxShadow value
159 const boxShadowValue = colored[color]
160 ? `${boxShadow([0, 3], [3, 0], palette[color].main, 0.15)}, ${boxShadow(
161 [0, 3],
162 [1, -2],
163 palette[color].main,
164 0.2
165 )}, ${boxShadow([0, 1], [5, 0], palette[color].main, 0.15)}`
166 : "none";
167
168 // boxShadow value when button is hovered
169 const hoveredBoxShadowValue = colored[color]
170 ? `${boxShadow([0, 14], [26, -12], palette[color].main, 0.4)}, ${boxShadow(
171 [0, 4],
172 [23, 0],
173 palette[color].main,
174 0.15
175 )}, ${boxShadow([0, 8], [10, -5], palette[color].main, 0.2)}`
176 : "none";
177
178 // color value
179 let colorValue = white.main;
180
181 if (color === "white") {
182 colorValue = text.main;
183 } else if (color === "light") {
184 colorValue = gradients.dark.state;
185 }
186
187 return {
188 background: backgroundValue,
189 color: colorValue,
190 boxShadow: boxShadowValue,
191
192 "&:hover": {
193 backgroundColor: white.main,
194 boxShadow: hoveredBoxShadowValue,
195 },
196
197 "&:focus:not(:hover)": {
198 boxShadow: boxShadowValue,
199 },
200
201 "&:disabled": {
202 background: backgroundValue,
203 color: colorValue,
204 },
205 };
206 };
207
208 // styles for the button with variant="text"

Callers 1

MKButtonRoot.jsFile · 0.70

Calls 2

linearGradientFunction · 0.85
boxShadowFunction · 0.85

Tested by

no test coverage detected