forked from primer/react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ButtonGroup.tsx
51 lines (42 loc) · 979 Bytes
/
ButtonGroup.tsx
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
47
48
49
50
51
import styled from 'styled-components'
import {get} from './constants'
import sx from './sx'
import {ComponentProps} from './utils/types'
const ButtonGroup = styled.div`
display: inline-flex;
vertical-align: middle;
&& > * {
position: relative;
border-right-width: 0;
border-radius: 0;
:first-child {
border-top-left-radius: ${get('radii.2')};
border-bottom-left-radius: ${get('radii.2')};
margin-right: 0;
}
:not(:first-child) {
margin-left: 0;
margin-right: 0;
}
:last-child {
border-right-width: 1px;
border-top-right-radius: ${get('radii.2')};
border-bottom-right-radius: ${get('radii.2')};
}
:focus,
:active,
:hover {
border-right-width: 1px;
+ * {
border-left-width: 0;
}
}
:focus,
:active {
z-index: 1;
}
}
${sx};
`
export type ButtonGroupProps = ComponentProps<typeof ButtonGroup>
export default ButtonGroup