From 6f31814513fcf7f6f1b4cb5ae0b40b99e7468278 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 1 Dec 2023 15:02:54 +0300 Subject: [PATCH] packages/ui: remove theme prop from Components --- packages/ui/grid.ts | 8 ++++---- packages/ui/utils.ts | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/ui/grid.ts b/packages/ui/grid.ts index e8b526d..954aa22 100644 --- a/packages/ui/grid.ts +++ b/packages/ui/grid.ts @@ -8,19 +8,19 @@ type WithArrayType = { type AllowedProps = Omit; -export type GridProps = Partial> & { theme: Theme }; +export type GridProps = Partial>; export const Grid = styled.div` display: grid; - ${({ theme, ...props }: GridProps) => getStyles(props, theme)} + ${({ theme, ...props }: GridProps & { theme: Theme }) => getStyles(props, theme)} `; export type FlexProps = GridProps; export const Flex = styled.div` display: flex; - ${({ theme, ...props }: GridProps) => getStyles(props, theme)} + ${({ theme, ...props }: GridProps & { theme: Theme }) => getStyles(props, theme)} `; export type BoxProps = GridProps; export const Box = styled.div` - ${({ theme, ...props }: GridProps) => getStyles(props, theme)} + ${({ theme, ...props }: GridProps & { theme: Theme }) => getStyles(props, theme)} `; diff --git a/packages/ui/utils.ts b/packages/ui/utils.ts index 95c33ee..41d80f2 100644 --- a/packages/ui/utils.ts +++ b/packages/ui/utils.ts @@ -1,12 +1,14 @@ import { dash, omit } from 'radash'; export type Theme = { breakpoints: string[] }; + function min(breakpoint: string, style: string) { return `@media (min-width: ${breakpoint}) { ${style} }`; } + export function getStyles(props: Record, theme: Theme) { const cleanProps = omit(props, ['children', 'id', 'key', 'className']);