2021-12-24 11:36:24 +00:00
|
|
|
import Base from '@appserver/components/themes/base';
|
|
|
|
import styled, { keyframes, css } from 'styled-components';
|
2020-11-16 15:49:06 +00:00
|
|
|
|
2020-11-18 14:09:48 +00:00
|
|
|
const StyledCircleWrap = styled.div`
|
|
|
|
width: 54px;
|
|
|
|
height: 54px;
|
2021-12-24 11:36:24 +00:00
|
|
|
background: none;
|
2020-11-18 14:09:48 +00:00
|
|
|
border-radius: 50%;
|
2021-01-19 11:14:15 +00:00
|
|
|
cursor: pointer;
|
2020-11-18 14:09:48 +00:00
|
|
|
`;
|
|
|
|
|
2021-05-04 19:14:42 +00:00
|
|
|
const rotate360 = keyframes`
|
|
|
|
from {
|
|
|
|
transform: rotate(0deg);
|
|
|
|
}
|
|
|
|
to {
|
|
|
|
transform: rotate(360deg);
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2021-12-24 11:36:24 +00:00
|
|
|
StyledCircleWrap.defaultProps = { theme: Base };
|
|
|
|
|
2020-11-18 14:09:48 +00:00
|
|
|
const StyledCircle = styled.div`
|
2020-11-18 14:14:47 +00:00
|
|
|
.circle__mask,
|
|
|
|
.circle__fill {
|
2020-11-16 15:49:06 +00:00
|
|
|
width: 54px;
|
|
|
|
height: 54px;
|
|
|
|
position: absolute;
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
2020-11-18 14:09:48 +00:00
|
|
|
|
2021-05-04 19:14:42 +00:00
|
|
|
${(props) =>
|
|
|
|
props.percent > 0
|
|
|
|
? css`
|
|
|
|
.circle__mask {
|
|
|
|
clip: rect(0px, 54px, 54px, 27px);
|
|
|
|
}
|
2020-11-18 14:09:48 +00:00
|
|
|
|
2021-05-04 19:14:42 +00:00
|
|
|
.circle__fill {
|
|
|
|
animation: fill-rotate ease-in-out none;
|
|
|
|
transform: rotate(${(props) => props.percent * 1.8}deg);
|
|
|
|
}
|
|
|
|
`
|
|
|
|
: css`
|
|
|
|
.circle__fill {
|
|
|
|
animation: ${rotate360} 2s linear infinite;
|
|
|
|
transform: translate(0);
|
|
|
|
}
|
|
|
|
`}
|
2020-11-18 14:09:48 +00:00
|
|
|
|
2020-11-18 14:14:47 +00:00
|
|
|
.circle__mask .circle__fill {
|
2020-11-16 15:49:06 +00:00
|
|
|
clip: rect(0px, 27px, 54px, 0px);
|
2021-12-24 11:36:24 +00:00
|
|
|
background-color: ${(props) => props.theme.floatingButton.color};
|
2020-11-16 15:49:06 +00:00
|
|
|
}
|
2020-11-18 14:09:48 +00:00
|
|
|
|
2020-11-18 14:14:47 +00:00
|
|
|
.circle__mask.circle__full {
|
2020-11-24 14:26:50 +00:00
|
|
|
animation: fill-rotate ease-in-out none;
|
2020-11-16 15:49:06 +00:00
|
|
|
transform: rotate(${(props) => props.percent * 1.8}deg);
|
|
|
|
}
|
2020-11-18 14:09:48 +00:00
|
|
|
|
|
|
|
@keyframes fill-rotate {
|
2020-11-16 15:49:06 +00:00
|
|
|
0% {
|
|
|
|
transform: rotate(0deg);
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
transform: rotate(${(props) => props.percent * 1.8}deg);
|
|
|
|
}
|
|
|
|
}
|
2020-11-18 14:09:48 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
const StyledFloatingButton = styled.div`
|
|
|
|
width: 48px;
|
|
|
|
height: 48px;
|
|
|
|
border-radius: 50%;
|
2022-01-20 15:45:33 +00:00
|
|
|
background: ${(props) =>
|
|
|
|
props.color ? props.color : props.theme.floatingButton.backgroundColor};
|
2022-01-20 15:46:46 +00:00
|
|
|
box-shadow: ${(props) => props.theme.floatingButton.boxShadow};
|
2020-11-18 14:09:48 +00:00
|
|
|
text-align: center;
|
|
|
|
margin: 3px;
|
|
|
|
position: absolute;
|
2020-11-16 11:47:30 +00:00
|
|
|
`;
|
|
|
|
|
2021-12-24 11:36:24 +00:00
|
|
|
StyledFloatingButton.defaultProps = { theme: Base };
|
|
|
|
|
2021-03-10 17:10:09 +00:00
|
|
|
const IconBox = styled.div`
|
|
|
|
padding-top: 12px;
|
2021-12-24 11:36:24 +00:00
|
|
|
svg {
|
|
|
|
path {
|
|
|
|
fill: ${(props) => props.theme.floatingButton.fill};
|
|
|
|
}
|
|
|
|
}
|
2021-03-10 17:10:09 +00:00
|
|
|
`;
|
|
|
|
|
2021-12-24 11:36:24 +00:00
|
|
|
IconBox.defaultProps = { theme: Base };
|
|
|
|
|
2020-11-16 11:47:30 +00:00
|
|
|
const StyledAlertIcon = styled.div`
|
|
|
|
position: absolute;
|
|
|
|
width: 12px;
|
|
|
|
height: 12px;
|
|
|
|
left: 26px;
|
2020-11-16 15:49:06 +00:00
|
|
|
top: -10px;
|
2020-11-16 11:47:30 +00:00
|
|
|
`;
|
|
|
|
|
2021-12-24 11:36:24 +00:00
|
|
|
export { StyledCircleWrap, StyledCircle, StyledFloatingButton, StyledAlertIcon, IconBox };
|