1
0
mirror of https://github.com/SomboChea/ui synced 2026-01-19 09:36:30 +07:00

refactor: use an enum with Logo size

This commit is contained in:
Sergio Herrera Guzmán
2019-07-10 11:25:12 +02:00
parent e9b881b979
commit 0d00ab4490
4 changed files with 14 additions and 9 deletions

View File

@@ -3,8 +3,13 @@ import React from 'react';
import styled from 'react-emotion';
import logo from './img/logo.svg';
export enum Size {
Small = '40px',
Big = '90px',
}
interface Props {
md?: boolean;
size?: Size;
}
const StyledLogo = styled('div')<Props>`
@@ -16,11 +21,11 @@ const StyledLogo = styled('div')<Props>`
background-size: contain;
background-image: url(${logo});
background-repeat: no-repeat;
width: ${({ md }) => (md ? '90px' : '40px')};
height: ${({ md }) => (md ? '90px' : '40px')};
width: ${({ size }) => size};
height: ${({ size }) => size};
`;
const Logo: React.FC<Props> = ({ md = false }) => {
return <StyledLogo md={md} />;
const Logo: React.FC<Props> = ({ size = Size.Small }) => {
return <StyledLogo size={size} />;
};
export default Logo;

View File

@@ -1 +1 @@
export { default } from './Logo';
export { default, Size } from './Logo';