fix: updated type to fix unit test

This commit is contained in:
Griffithtp
2019-06-25 23:29:53 +01:00
parent 2f28ade710
commit 7cab3f289e
7 changed files with 42 additions and 23 deletions

View File

@@ -61,14 +61,14 @@ export interface Props {
size?: Breakpoint;
pointer?: boolean;
img?: boolean;
modifiers?: null | undefined;
// modifiers?: null | undefined;
}
const Icon: React.FC<Props> = ({ className, name, size = 'sm', img = false, pointer = false, ...props }) => {
// @ts-ignore
const title = capitalize(name);
return img ? (
<ImgWrapper className={className} pointer={pointer} size={size} title={title} {...props}>
<ImgWrapper className={className} name={name} pointer={pointer} size={size} title={title} {...props}>
<Img alt={title} src={Icons[name]} />
</ImgWrapper>
) : (

View File

@@ -1,5 +1,7 @@
import styled, { css } from 'react-emotion';
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
import { StyledOtherComponent } from 'create-emotion-styled';
import { DetailedHTMLProps, HTMLAttributes } from 'react';
const getSize = (size: Breakpoint): string => {
switch (size) {
@@ -31,7 +33,16 @@ export const Svg = styled('svg')`
}
`;
export const ImgWrapper = styled('span')`
export const ImgWrapper: StyledOtherComponent<
{
size?: Breakpoint;
pointer: any;
modifiers?: any;
name?: string | unknown;
},
DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>,
{}
> = styled('span')`
&& {
${commonStyle};
}