Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
background-color: ${color.grey(2)};
color: ${color.grey(4)};
line-height: 1.35;
padding: 0.75rem 0;
font-size: ${font.size(2)};
font-weight: 500;
transition: all 85ms ease-out;
&:hover {
opacity: 0.6;
}
`
const StyledImage = styled.img`
max-width: 100%;
border-radius: ${radius('small')};
transition: opacity ${timing('short')} ease-out;
margin: 0;
display: block;
`
const DeleteButton = styled(IconButton)`
top: 0.5rem;
right: 0.5rem;
position: absolute;
&:not(:hover) {
fill: ${color.grey()};
background-color: transparent;
border-color: transparent;
}
`
const StyledImageContainer = styled.div`
background-color: ${color.grey(2)};
color: ${color.grey(4)};
line-height: 1.35;
padding: 0.75rem 0;
font-size: ${font.size(2)};
font-weight: 500;
transition: all 85ms ease-out;
&:hover {
opacity: 0.6;
}
`
const StyledImage = styled.img`
max-width: 100%;
border-radius: ${radius('small')};
transition: opacity ${timing('short')} ease-out;
${DropArea}:hover & {
opacity: 0.6;
}
`
export const ImageUpload = ({
onDrop,
value,
previewSrc,
}: ImageUploadProps) => {
const {
getRootProps,
getInputProps,
isDragActive,
isDragAccept,
isDragReject,
p {
display: block;
margin: 0 0 ${padding()} 0;
}
`
const LinkButton = styled.a`
text-align: center;
border: 0;
border-radius: ${radius('big')};
border: 1px solid ${color.grey(2)};
box-shadow: ${shadow('small')};
font-weight: 500;
cursor: pointer;
font-size: ${font.size(0)};
transition: all ${timing('short')} ease-out;
background-color: white;
color: ${color.grey(8)};
padding: ${padding('small')} ${padding('big')} ${padding('small')} 3.5rem;
position: relative;
text-decoration: none;
display: inline-block;
${Emoji} {
font-size: 1.5rem;
position: absolute;
left: ${padding('big')};
top: 50%;
transform-origin: 50% 50%;
transform: translate3d(0, -50%, 0);
transition: all ${timing('short')} ease-out;
}
&:hover {
top: 0.5rem;
bottom: 0.5rem;
left: 0.5rem;
right: 0.5rem;
border-radius: ${radius()};
background-color: ${color.grey(9)};
z-index: -1;
transition: all 150ms ease;
transform: translate3d(0, 100%, 0);
opacity: 0;
}
&:hover {
color: ${color.primary('light')};
&:after {
transform: translate3d(0, 0, 0);
transition: transform ${timing('short')} ease-out, opacity 0ms;
opacity: 1;
}
svg {
fill: ${color.primary()};
}
& ~ * {
&:after {
transform: translate3d(0, -100%, 0);
}
}
}
svg {
position: absolute;
left: ${padding()};
top: 50%;
transform: translate3d(0, -50%, 0);
align-items: center;
justify-content: center;
font-size: ${font.size(1)};
font-weight: bold;
width: 100%;
height: 2.5rem;
border-radius: ${radius('big')};
box-shadow: inset 0 0 1px 1px rgba(0, 0, 0, 0.075);
background: ${props =>
props.colorRGBA
? `rgba(${props.colorRGBA.r}, ${props.colorRGBA.g}, ${props.colorRGBA.b}, ${props.colorRGBA.a})`
: `#fff`};
color: ${props => GetTextColorForBackground(props.colorRGBA)};
transition: all ${timing('short')} ease-out;
}
&:hover {
> div {
opacity: 0.6;
}
}
`
const ColorPopupKeyframes = keyframes`
0% {
transform: translate3d(-50%, 5px, 0) scale3d(0.5,0.5,1)
}
100% {
transform: translate3d(-50%, 5px, 0) scale3d(1, 1, 1);
}