Switch: Add hover effect for inline switch (#34387)

This commit is contained in:
Torkel Ödegaard
2021-05-19 16:25:04 +02:00
committed by GitHub
parent 8ddf6de6e7
commit c944a33b95

View File

@@ -54,7 +54,10 @@ export const InlineSwitch = React.forwardRef<HTMLInputElement, InlineSwitchProps
return (
<div className={styles.inlineContainer}>
{showLabel && (
<label htmlFor={id} className={cx(styles.inlineLabel, value && styles.inlineLabelEnabled)}>
<label
htmlFor={id}
className={cx(styles.inlineLabel, value && styles.inlineLabelEnabled, 'inline-switch-label')}
>
{label}
</label>
)}
@@ -145,6 +148,14 @@ const getSwitchStyles = stylesFactory((theme: GrafanaTheme2, transparent?: boole
background: ${transparent ? 'transparent' : theme.components.input.background};
border: 1px solid ${transparent ? 'transparent' : theme.components.input.borderColor};
border-radius: ${theme.shape.borderRadius()};
&:hover {
border: 1px solid ${transparent ? 'transparent' : theme.components.input.borderHover};
.inline-switch-label {
color: ${theme.colors.text.primary};
}
}
`,
inlineLabel: css`
cursor: pointer;