Created
September 19, 2017 09:56
-
-
Save vsaarinen/32e7f0ac734a5a9313abfb1bc1e55d91 to your computer and use it in GitHub Desktop.
TypeScript type definitions for grid-styled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
type NumberStringOrArray = number | string | number[] | string[]; | |
interface BoxProps { | |
width?: NumberStringOrArray; | |
m?: NumberStringOrArray; | |
mt?: NumberStringOrArray; | |
mr?: NumberStringOrArray; | |
mb?: NumberStringOrArray; | |
ml?: NumberStringOrArray; | |
mx?: NumberStringOrArray; | |
my?: NumberStringOrArray; | |
p?: NumberStringOrArray; | |
pt?: NumberStringOrArray; | |
pr?: NumberStringOrArray; | |
pb?: NumberStringOrArray; | |
pl?: NumberStringOrArray; | |
px?: NumberStringOrArray; | |
py?: NumberStringOrArray; | |
flex?: string | string[]; | |
order?: NumberStringOrArray; | |
is?: React.ComponentClass | string; | |
} | |
type AlignOption = 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'; | |
type JustifyOption = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly'; | |
type DirectionOption = 'row' | 'row-reverse' | 'column' | 'column-reverse'; | |
interface FlexProps { | |
align?: AlignOption | AlignOption[]; | |
justify?: JustifyOption | JustifyOption[]; | |
direction?: DirectionOption | DirectionOption[]; | |
// Sets flex-wrap: wrap | |
wrap?: boolean | boolean[]; | |
// Shortcut for flex-direction: column | |
column?: boolean; | |
} | |
declare class Box extends React.Component<BoxProps> {} | |
declare class Grid extends React.Component<BoxProps> {} | |
declare class Flex extends React.Component<BoxProps & FlexProps> {} | |
export { Grid, Box, Flex }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment