2019-02-03 17:23:33 +07:00
|
|
|
import styled, { css } from 'react-emotion';
|
2019-06-25 05:54:32 +07:00
|
|
|
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
|
2019-06-26 05:29:53 +07:00
|
|
|
import { StyledOtherComponent } from 'create-emotion-styled';
|
|
|
|
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
2019-02-03 17:23:33 +07:00
|
|
|
|
2019-06-25 05:54:32 +07:00
|
|
|
const getSize = (size: Breakpoint): string => {
|
2019-02-03 17:23:33 +07:00
|
|
|
switch (size) {
|
|
|
|
case 'md':
|
|
|
|
return `
|
|
|
|
width: 18px;
|
|
|
|
height: 18px;
|
|
|
|
`;
|
|
|
|
default:
|
|
|
|
return `
|
|
|
|
width: 14px;
|
2019-03-28 05:39:06 +07:00
|
|
|
height: 16px;
|
2019-02-03 17:23:33 +07:00
|
|
|
`;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-06-25 05:54:32 +07:00
|
|
|
const commonStyle = ({ size = 'sm' as Breakpoint, pointer, modifiers = null }): string => css`
|
2019-02-03 17:23:33 +07:00
|
|
|
&& {
|
|
|
|
display: inline-block;
|
2019-08-12 12:06:10 +07:00
|
|
|
cursor: ${pointer ? 'pointer' : 'Developers'};
|
2019-02-03 17:23:33 +07:00
|
|
|
${getSize(size)};
|
|
|
|
${modifiers && modifiers};
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2019-06-20 19:37:28 +07:00
|
|
|
export const Svg = styled('svg')`
|
2019-02-03 17:23:33 +07:00
|
|
|
&& {
|
|
|
|
${commonStyle};
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2019-06-26 05:29:53 +07:00
|
|
|
export const ImgWrapper: StyledOtherComponent<
|
|
|
|
{
|
|
|
|
size?: Breakpoint;
|
2019-06-26 06:10:15 +07:00
|
|
|
pointer: boolean;
|
|
|
|
modifiers?: null | undefined;
|
2019-06-26 05:29:53 +07:00
|
|
|
name?: string | unknown;
|
|
|
|
},
|
|
|
|
DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>,
|
|
|
|
{}
|
|
|
|
> = styled('span')`
|
2019-02-03 17:23:33 +07:00
|
|
|
&& {
|
|
|
|
${commonStyle};
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2019-07-15 16:57:32 +07:00
|
|
|
export const Img = styled('img')({
|
|
|
|
'&&': {
|
|
|
|
width: '100%',
|
|
|
|
height: 'auto',
|
|
|
|
},
|
|
|
|
});
|