[styled-system] Allow null ResponsiveValue (#42961)

This commit is contained in:
Jeffrey Cherewaty 2020-03-09 04:53:31 -05:00 committed by GitHub
parent 9507f878ee
commit 3692d1c231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -60,7 +60,7 @@ export type RequiredTheme = Required<Theme>;
export type ResponsiveValue<
T,
ThemeType extends Theme = RequiredTheme,
> = T | Array<T | null> | { [key in ThemeValue<'breakpoints', ThemeType> & string | number]?: T };
> = T | null | Array<T | null> | { [key in ThemeValue<'breakpoints', ThemeType> & string | number]?: T };
export type ThemeValue<K extends keyof ThemeType, ThemeType, TVal = any> =
ThemeType[K] extends TVal[] ? number :

View File

@ -220,6 +220,7 @@ const test = () => (
<Box display={{ sm: 'block', md: 'inline-block' }} />
// maxWidth (responsive)
<Box maxWidth={1024} />
<Box maxWidth={null} />
<Box maxWidth={[768, null, null, 1024]} />
<Box maxWidth={{ sm: 768, lg: 1024 }} />
// minWidth (responsive)