1
0
Fork 1
mirror of https://github.com/SomboChea/ui synced 2024-06-02 09:35:06 +07:00
verdaccio-ui/src/components/Icon/styles.ts

43 lines
931 B
TypeScript
Raw Normal View History

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