Skip to content

Commit

Permalink
fix: Improve types
Browse files Browse the repository at this point in the history
  • Loading branch information
sapegin committed Dec 19, 2022
1 parent 3c85cce commit b16f8c7
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 132 deletions.
6 changes: 3 additions & 3 deletions src/components/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import { ReactNode } from 'react';
import styled, { DefaultTheme } from 'styled-components';
import { getCss, PrimitiveProps, CSSProps } from '../primitives';
import { getCss, RestrictedProps, CSSProps } from '../primitives';

export type BoxProps = PrimitiveProps<DefaultTheme> & {
export type BoxProps = RestrictedProps<DefaultTheme> & {
children: ReactNode;
css?: CSSProps;
css?: CSSProps<DefaultTheme>;
};

/**
Expand Down
14 changes: 0 additions & 14 deletions src/components/Flex.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import styled from 'styled-components';
import Box, { BoxProps } from './Box';

Expand All @@ -14,16 +13,3 @@ Flex.defaultProps = {
};

export default Flex;

function Xxx() {
return (
<Box
p="l"
marginBottom="xdsdf"
width={[1, 1, 1 / 2]}
css={{ fontSize: 'l', color: 'bg', bg: 'hover' }}
>
Pizza!
</Box>
);
}
2 changes: 1 addition & 1 deletion src/components/Frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Inner = styled.div`
*/
export default function Frame({ children, ratio, ...props }: FrameProps) {
return (
<Box {...props} position="relative" pb={`${ratio * 100}%`}>
<Box {...props} position="relative" css={{ pb: `${ratio * 100}%` }}>
<Inner>{children}</Inner>
</Box>
);
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { css, getCss } from './css';
export { variant } from './variant';
export type { PrimitiveProps, CSSProps, ResponsiveValue } from './types';
export type { RestrictedProps, CSSProps, ResponsiveValue } from './types';
Loading

0 comments on commit b16f8c7

Please sign in to comment.