File size: 3,006 Bytes
1e92f2d |
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
// @flow
import theme from 'shared/theme';
import styled, { css } from 'styled-components';
import ReactImage from 'react-image';
import { zIndex } from '../globals';
import { Link } from 'react-router-dom';
import { ProfileHeaderAction } from '../profile/style';
import { MEDIA_BREAK } from 'src/components/layout';
export const Container = styled.div`
position: relative;
display: inline-block;
width: ${props => (props.size ? `${props.size}px` : '32px')};
height: ${props => (props.size ? `${props.size}px` : '32px')};
border-radius: ${props =>
props.type === 'community' ? `${props.size / 8}px` : '100%'};
border: none;
background-color: ${theme.bg.default};
${props =>
props.mobilesize &&
css`
@media (max-width: ${MEDIA_BREAK}px) {
width: ${props => `${props.mobilesize}px`};
height: ${props => `${props.mobilesize}px`};
}
`};
`;
export const AvatarLink = styled(Link)`
display: flex;
flex: none;
flex-direction: column;
height: 100%;
width: 100%;
justify-content: center;
align-items: center;
pointer-events: auto;
border-radius: ${props =>
props.type === 'community' ? `${props.size / 8}px` : '100%'};
`;
export const CoverAction = styled(ProfileHeaderAction)`
position: absolute;
top: 12px;
right: 12px;
z-index: ${zIndex.tooltip + 1};
`;
export const Img = styled(ReactImage)`
display: inline-block;
width: ${props => (props.size ? `${props.size}px` : '32px')};
height: ${props => (props.size ? `${props.size}px` : '32px')};
border-radius: ${props =>
props.type === 'community' ? `${props.size / 8}px` : '100%'};
object-fit: cover;
background-color: ${theme.bg.default};
${props =>
props.mobilesize &&
css`
@media (max-width: ${MEDIA_BREAK}px) {
width: ${props => `${props.mobilesize}px`};
height: ${props => `${props.mobilesize}px`};
}
`};
`;
export const FallbackImg = styled.img`
display: inline-block;
width: ${props => (props.size ? `${props.size}px` : '32px')};
height: ${props => (props.size ? `${props.size}px` : '32px')};
border-radius: ${props =>
props.type === 'community' ? `${props.size / 8}px` : '100%'};
object-fit: cover;
background-color: ${theme.bg.wash};
${props =>
props.mobilesize &&
css`
@media (max-width: ${MEDIA_BREAK}px) {
width: ${props => `${props.mobilesize}px`};
height: ${props => `${props.mobilesize}px`};
}
`};
`;
export const LoadingImg = styled.div`
display: inline-block;
width: ${props => (props.size ? `${props.size}px` : '32px')};
height: ${props => (props.size ? `${props.size}px` : '32px')};
border-radius: ${props =>
props.type === 'community' ? `${props.size / 8}px` : '100%'};
background: ${theme.bg.wash};
${props =>
props.mobilesize &&
css`
@media (max-width: ${MEDIA_BREAK}px) {
width: ${props => `${props.mobilesize}px`};
height: ${props => `${props.mobilesize}px`};
}
`};
`;
|