From aa2de9e6174382d92b6b09d6b977d0c650671e78 Mon Sep 17 00:00:00 2001 From: Adam Misiorny Date: Thu, 17 Jan 2019 20:02:05 +0100 Subject: [PATCH 1/2] Add support for responsive object https://github.com/jxnblk/styled-system/blob/master/docs/responsive-styles.md#using-objects --- types/styled-system/index.d.ts | 1 + types/styled-system/styled-system-tests.tsx | 51 +++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/types/styled-system/index.d.ts b/types/styled-system/index.d.ts index ca2f7ce1fc..a26a6d98b6 100644 --- a/types/styled-system/index.d.ts +++ b/types/styled-system/index.d.ts @@ -8,6 +8,7 @@ // Matthieu Vachon // Adam Lavin // Joachim Schuler +// Adam Misiorny // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/styled-system/styled-system-tests.tsx b/types/styled-system/styled-system-tests.tsx index 4608aeebec..397e1b0402 100644 --- a/types/styled-system/styled-system-tests.tsx +++ b/types/styled-system/styled-system-tests.tsx @@ -314,12 +314,15 @@ const test = () => ( // responsive width + // responsive font-size + // responsive margin // responsive padding + // examples (margin prop) // sets margin value of `theme.space[2]` // sets margin value of `-1 * theme.space[2]` @@ -332,6 +335,7 @@ const test = () => ( // sets margin `8px` on all viewports and `16px` from the smallest breakpoint and up + // examples // width `50%` // width `256px` @@ -341,6 +345,7 @@ const test = () => ( // width `100%` on all viewports and `50%` from the smallest breakpoint and up + // examples // font-size of `theme.fontSizes[3]` // font-size `32px` @@ -350,6 +355,7 @@ const test = () => ( // font-size `10px` on all viewports and `12px` from the smallest breakpoint and up + // examples // picks the value defined in `theme.colors['blue']` // picks up a nested color value using dot notation // @@ -362,6 +368,7 @@ const test = () => ( // textAlign (responsive) + // lineHeight // fontWeight @@ -371,72 +378,107 @@ const test = () => ( // display (responsive) + // maxWidth (responsive) + // minWidth (responsive) + // height (responsive) + // maxHeight (responsive) + // minHeight (responsive) + // size (responsive, width & height) + // ratio (height: 0 & paddingBottom) // alignItems (responsive) + + // alignContent (responsive) + + // justifyContent (responsive) + + // flexWrap (responsive) + + // flexBasis (responsive) // flexDirection (responsive) + + // gridGap + // gridRowGap + // gridColumnGap + // gridRow + + // gridColumn + + // gridAutoFlow + // gridAutoRows + // gridAutoColumns + // gridTemplateRows + // gridTemplateColumns + // flex (responsive) + + // justifySelf (responsive) + + // alignSelf (responsive) + + @@ -448,10 +490,19 @@ const test = () => ( // position (responsive) + + // zIndex // top, right, bottom, left (responsive) + + // boxShadow // backgroundImage, backgroundSize, backgroundPosition, backgroundRepeat From 9924356848bf972cb5fed7dd041728c37f9197e0 Mon Sep 17 00:00:00 2001 From: Adam Misiorny Date: Thu, 17 Jan 2019 20:13:12 +0100 Subject: [PATCH 2/2] Add missing line --- types/styled-system/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/styled-system/index.d.ts b/types/styled-system/index.d.ts index a26a6d98b6..4ba8a04be8 100644 --- a/types/styled-system/index.d.ts +++ b/types/styled-system/index.d.ts @@ -44,7 +44,7 @@ export interface LowLevelStylefunctionArguments { export function style(args: LowLevelStylefunctionArguments): {[cssProp: string]: string}; export type TLengthStyledSystem = string | 0 | number; -export type ResponsiveValue = T | Array; +export type ResponsiveValue = T | Array | { [key: string]: T }; /** * Converts shorthand margin and padding props to margin and padding CSS declarations