forked from psychobolt/react-pie-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PieMenu.style.js
41 lines (37 loc) · 1.4 KB
/
PieMenu.style.js
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
import { css } from 'styled-components';
export const container = css`
display: inline-block;
position: ${({ centerX, centerY }) => ((centerX || centerY) ? 'absolute' : 'relative')};
top: calc(${({ centerY }) => centerY} - ${({ radius }) => radius});
left: calc(${({ centerX }) => centerX} - ${({ radius }) => radius});
border-radius: 50%;
overflow: hidden;
`;
export const list = css`
position: relative;
list-style: none;
padding: 0;
margin: 0;
border-radius: 50%;
width: calc(2 * ${({ radius }) => radius});
height: calc(2 * ${({ radius }) => radius});
`;
export const item = css`
width: ${({ centralAngle }) => (centralAngle > 90 ? '100%' : '50%')};
height: ${({ centralAngle }) => (centralAngle > 90 ? '100%' : '50%')};
bottom: ${({ centralAngle }) => (centralAngle > 90 ? '50%' : 'initial')};
right: ${({ centralAngle }) => (centralAngle > 90 ? '50%' : 'initial')};
position: absolute;
transform: rotate(${({ startAngle, endAngle }) => startAngle + endAngle}deg) skew(${({ skew }) => skew}deg);
transform-origin: bottom right;
overflow: hidden;
`;
export const center = css`
position: absolute;
border-radius: 50%;
background: transparent;
top: calc(50% - ${({ centerRadius }) => centerRadius});
left: calc(50% - ${({ centerRadius }) => centerRadius});
width: calc(2 * ${({ centerRadius }) => centerRadius});
height: calc(2 * ${({ centerRadius }) => centerRadius});
`;