-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
ButtonGroup.styles.ts
46 lines (40 loc) · 1.56 KB
/
ButtonGroup.styles.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { createStyles } from '@mantine/styles';
export interface ButtonGroupStylesParams {
orientation: 'vertical' | 'horizontal';
buttonBorderWidth: number;
}
export default createStyles(
(_theme, { orientation, buttonBorderWidth }: ButtonGroupStylesParams) => ({
root: {
display: 'flex',
flexDirection: orientation === 'vertical' ? 'column' : 'row',
'& [data-button]': {
'&:first-of-type': {
borderBottomRightRadius: 0,
[orientation === 'vertical' ? 'borderBottomLeftRadius' : 'borderTopRightRadius']: 0,
[orientation === 'vertical' ? 'borderBottomWidth' : 'borderRightWidth']:
buttonBorderWidth / 2,
},
'&:last-of-type': {
borderTopLeftRadius: 0,
[orientation === 'vertical' ? 'borderTopRightRadius' : 'borderBottomLeftRadius']: 0,
[orientation === 'vertical' ? 'borderTopWidth' : 'borderLeftWidth']:
buttonBorderWidth / 2,
},
'&:not(:first-of-type):not(:last-of-type)': {
borderRadius: 0,
[orientation === 'vertical' ? 'borderTopWidth' : 'borderLeftWidth']:
buttonBorderWidth / 2,
[orientation === 'vertical' ? 'borderBottomWidth' : 'borderRightWidth']:
buttonBorderWidth / 2,
},
'& + [data-button]': {
[orientation === 'vertical' ? 'marginTop' : 'marginLeft']: -buttonBorderWidth,
'@media (min-resolution: 192dpi)': {
[orientation === 'vertical' ? 'marginTop' : 'marginLeft']: 0,
},
},
},
},
})
);