mirror of
https://github.com/SomboChea/ui
synced 2024-11-05 06:04:28 +07:00
45 lines
769 B
TypeScript
45 lines
769 B
TypeScript
import styled, { css } from 'react-emotion';
|
|
|
|
const getSize = (size: 'md' | 'sm' | string): string => {
|
|
switch (size) {
|
|
case 'md':
|
|
return `
|
|
width: 18px;
|
|
height: 18px;
|
|
`;
|
|
default:
|
|
return `
|
|
width: 14px;
|
|
height: 16px;
|
|
`;
|
|
}
|
|
};
|
|
|
|
const commonStyle = ({ size = 'sm' as 'md' | 'sm' | string, pointer, modifiers = null }): string => css`
|
|
&& {
|
|
display: inline-block;
|
|
cursor: ${pointer ? 'pointer' : 'default'};
|
|
${getSize(size)};
|
|
${modifiers && modifiers};
|
|
}
|
|
`;
|
|
|
|
export const Svg = styled('svg')`
|
|
&& {
|
|
${commonStyle};
|
|
}
|
|
`;
|
|
|
|
export const ImgWrapper = styled('span')`
|
|
&& {
|
|
${commonStyle};
|
|
}
|
|
`;
|
|
|
|
export const Img = styled('img')`
|
|
&& {
|
|
width: 100%;
|
|
height: auto;
|
|
}
|
|
`;
|