ToolbarSwitch: Fixes internal border radius and other issues (#111432)
This commit is contained in:
@@ -2,7 +2,7 @@ import { css, cx } from '@emotion/css';
|
|||||||
import { MouseEvent } from 'react';
|
import { MouseEvent } from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2, IconName } from '@grafana/data';
|
import { GrafanaTheme2, IconName } from '@grafana/data';
|
||||||
import { Icon, Tooltip, useStyles2 } from '@grafana/ui';
|
import { Icon, styleMixins, Tooltip, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
icon: IconName;
|
icon: IconName;
|
||||||
@@ -91,28 +91,18 @@ const getStyles = (theme: GrafanaTheme2) => ({
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
width: theme.spacing(2.5),
|
width: theme.spacing(2.5),
|
||||||
height: theme.spacing(2.5),
|
height: '100%',
|
||||||
borderRadius: theme.shape.radius.default,
|
|
||||||
transform: 'translateX(0)',
|
transform: 'translateX(0)',
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
|
borderRadius: styleMixins.getInternalRadius(theme, 2),
|
||||||
|
border: `1px solid ${theme.colors.secondary.border}`,
|
||||||
|
|
||||||
[theme.transitions.handleMotion('no-preference', 'reduce')]: {
|
[theme.transitions.handleMotion('no-preference', 'reduce')]: {
|
||||||
transition: 'all 0.2s ease-in-out',
|
transition: 'all 0.2s ease-in-out',
|
||||||
},
|
},
|
||||||
|
|
||||||
'&:after': css({
|
|
||||||
content: "''",
|
|
||||||
position: 'absolute',
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
|
||||||
borderRadius: theme.shape.radius.default,
|
|
||||||
background: theme.colors.secondary.main,
|
|
||||||
border: `1px solid ${theme.colors.secondary.border}`,
|
|
||||||
}),
|
|
||||||
}),
|
}),
|
||||||
boxChecked: css({
|
boxChecked: css({
|
||||||
transform: `translateX(calc(100% - ${theme.spacing(0.25)}))`,
|
transform: `translateX(calc(100% - ${theme.spacing(0.25)}))`,
|
||||||
|
borderColor: 'transparent',
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user