81 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-09-11 11:00:40 +02:00
import styled, { css, keyframes } from 'styled-components';
const Label = styled.label`
position: relative;
height: 146px;
width: 100%;
padding-top: 28px;
border: 2px dashed #e3e9f3;
border-radius: 2px;
text-align: center;
> input {
display: none;
}
.icon {
width: 82px;
path {
fill: ${({ showLoader }) => (showLoader ? '#729BEF' : '#ccd0da')};
transition: fill 0.3s ease;
}
}
.isDraging {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.underline {
color: #1c5de7;
text-decoration: underline;
cursor: pointer;
}
&:hover {
cursor: pointer;
}
${({ isDraging }) => {
if (isDraging) {
return css`
background-color: rgba(28, 93, 231, 0.01) !important;
border: 2px dashed rgba(28, 93, 231, 0.1) !important;
`;
}
return '';
2019-09-11 11:00:40 +02:00
}}
${({ showLoader }) => {
if (showLoader) {
return css`
animation: ${smoothBlink('transparent', 'rgba(28,93,231,0.05)')} 2s
linear infinite;
`;
}
return '';
2019-09-11 11:00:40 +02:00
}}
`;
const smoothBlink = (firstColor, secondColor) => keyframes`
0% {
fill: ${firstColor};
background-color: ${firstColor};
}
26% {
fill: ${secondColor};
background-color: ${secondColor};
}
76% {
fill: ${firstColor};
background-color: ${firstColor};
}
`;
export default Label;