2019-11-23 19:41:14 +07:00
|
|
|
import styled from '@emotion/styled';
|
2019-06-25 05:54:32 +07:00
|
|
|
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
|
2019-02-03 17:23:33 +07:00
|
|
|
|
2019-11-23 19:41:14 +07:00
|
|
|
const getSize = (size: Breakpoint): { width: number; height: number } => {
|
2019-02-03 17:23:33 +07:00
|
|
|
switch (size) {
|
|
|
|
case 'md':
|
2019-11-23 19:41:14 +07:00
|
|
|
return {
|
|
|
|
width: 18,
|
|
|
|
height: 18,
|
|
|
|
};
|
2019-02-03 17:23:33 +07:00
|
|
|
default:
|
2019-11-23 19:41:14 +07:00
|
|
|
return {
|
|
|
|
width: 14,
|
|
|
|
height: 16,
|
|
|
|
};
|
2019-02-03 17:23:33 +07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-11-23 19:41:14 +07:00
|
|
|
interface CommonStyleProps {
|
|
|
|
size: Breakpoint;
|
|
|
|
pointer?: boolean;
|
|
|
|
}
|
2020-04-06 00:34:42 +07:00
|
|
|
|
2019-11-23 19:41:14 +07:00
|
|
|
const commonStyle = ({ size = 'sm', pointer }: CommonStyleProps): object => ({
|
|
|
|
display: 'inline-block',
|
|
|
|
cursor: pointer ? 'pointer' : 'default',
|
|
|
|
...getSize(size),
|
|
|
|
});
|
2019-02-03 17:23:33 +07:00
|
|
|
|
2019-11-23 19:41:14 +07:00
|
|
|
export const Svg = styled('svg')<CommonStyleProps>(props => ({
|
|
|
|
boxSizing: 'initial',
|
|
|
|
...commonStyle(props),
|
|
|
|
}));
|
2019-02-03 17:23:33 +07:00
|
|
|
|
2019-11-23 19:41:14 +07:00
|
|
|
export const ImgWrapper = styled('span')<CommonStyleProps>(props => ({
|
|
|
|
boxSizing: 'initial',
|
|
|
|
...commonStyle(props),
|
|
|
|
}));
|
2019-02-03 17:23:33 +07:00
|
|
|
|
2019-07-15 16:57:32 +07:00
|
|
|
export const Img = styled('img')({
|
2019-11-23 19:41:14 +07:00
|
|
|
width: '100%',
|
|
|
|
height: 'auto',
|
2019-07-15 16:57:32 +07:00
|
|
|
});
|