Updated babel-plugin-styled-components to a new version that works. Added extra option to macros settings to not bother showing the file names.
61 lines
1.1 KiB
TypeScript
61 lines
1.1 KiB
TypeScript
import styled from "styled-components/macro";
|
|
|
|
/**
|
|
* scale is a percentage (0-100%)
|
|
* */
|
|
type OverlayImageProps = {
|
|
src: string,
|
|
scale?: number,
|
|
};
|
|
export const OverlayImage = styled.img.attrs<OverlayImageProps>(({
|
|
src,
|
|
}) => ({
|
|
draggable: false,
|
|
src,
|
|
}))<OverlayImageProps>`
|
|
width: ${({ scale = 100 }) => `${scale}%`};
|
|
|
|
&:active {
|
|
outline: 2px solid red;
|
|
outline-offset: -2px;
|
|
}
|
|
`;
|
|
|
|
type OverlayImageContainerProps = {
|
|
opacity: number,
|
|
};
|
|
export const OverlayImageContainer = styled.div.attrs<OverlayImageContainerProps>(({
|
|
opacity,
|
|
}) => ({
|
|
style: {
|
|
opacity,
|
|
},
|
|
}))<OverlayImageContainerProps>`
|
|
display: flex;
|
|
|
|
&:hover {
|
|
> span {
|
|
display: inline;
|
|
}
|
|
}
|
|
|
|
`;
|
|
|
|
export const OverlayImageSubContainer = styled.div`
|
|
flex-shrink: 0;
|
|
`;
|
|
|
|
export const OverlayImageSize = styled.span`
|
|
position: absolute;
|
|
display: none;
|
|
|
|
left: 0;
|
|
bottom: -1.5em;
|
|
width: 15ch;
|
|
|
|
color: red;
|
|
font-family: ${p => p.theme.fonts.f1Regular};
|
|
font-size: 1em;
|
|
text-shadow: -1px -1px 1px rgba(255,255,255,.1), 1px 1px 1px rgba(0,0,0,.5);
|
|
`;
|