Skip to content

Commit

Permalink
chore: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
ob6160 committed Jun 27, 2021
1 parent 999b08f commit 806bfe7
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/components/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
BorderProps,
LayoutProps,
} from 'styled-system';
import { createPropTypes } from '@styled-system/prop-types';

interface IBoxProps extends ColorProps, SpaceProps, FlexboxProps, PositionProps, BorderProps, LayoutProps {
children: React.ReactNode;
Expand Down
21 changes: 15 additions & 6 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React from 'react';
import styled from '@emotion/styled';
import { variant } from 'styled-system';
import React, { AnchorHTMLAttributes, ComponentPropsWithoutRef, ElementType, LegacyRef } from 'react';
import styled, { StyledComponent } from '@emotion/styled';
import { buttonStyle, ButtonStyleProps, variant } from 'styled-system';

import Box from '../Box';
import Text from '../Text';

const BUTTON_HEIGHT = 34;

const StyledButton = styled.button(

const StyledButton = styled.button<IButtonProps>(
(props) =>
`
display: inline-flex;
Expand Down Expand Up @@ -68,14 +69,22 @@ const StyledButton = styled.button(
minHeight: 0,
},
},
})
}),
buttonStyle
);

const ButtonIcon = ({ icon }) => {
return <Box mr={2}>{icon}</Box>;
};

const Button = React.forwardRef(({ children, icon, ...props }, ref) => (

interface IButtonProps extends ButtonStyleProps {
icon?: JSX.Element;
}

type ButtonProps = IButtonProps & ComponentPropsWithoutRef<typeof StyledButton>;

const Button = React.forwardRef<HTMLButtonElement & HTMLAnchorElement, ButtonProps>(({ children, icon, ...props }, ref) => (
<StyledButton ref={ref} type="button" {...props}>
{Boolean(icon) && <ButtonIcon icon={icon} />}

Expand Down
4 changes: 2 additions & 2 deletions src/components/Header/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ const MainMenu = ({
</Box>

{children && (
<Box as={Media} lessThan="md">
<Media lessThan="md">
<Text fontWeight="normal">{children}</Text>
</Box>
</Media>
)}
</Box>
</Text>
Expand Down
File renamed without changes.
22 changes: 22 additions & 0 deletions src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,27 @@ const theme = {
)
};

import "@emotion/react";

declare module "@emotion/react" {
export interface Theme {
breakpoints: string[];
space: number[];
radii: number[];
fontSizes: number[];
colors: {
primary: string;
secondary: string;
tertiary: string;
ice: string;
white: string;
lightGrey: string;
grey: string;
aqua: string;
};
mediaQueries: string[];
}
}


export default theme;

0 comments on commit 806bfe7

Please sign in to comment.