forked from primer/react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.ts
44 lines (29 loc) · 1.17 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import {themeGet} from '@styled-system/theme-get'
// eslint-disable-next-line import/no-namespace
import * as styledSystem from 'styled-system'
import theme from './theme'
const {get: getKey, compose, system} = styledSystem
export const get = (key: string) => themeGet(key, getKey(theme, key))
// Common props
export const COMMON = compose(styledSystem.space, styledSystem.color, styledSystem.display)
export interface SystemCommonProps
extends styledSystem.ColorProps,
styledSystem.SpaceProps,
styledSystem.DisplayProps {}
// Typography props
const whiteSpace = system({
whiteSpace: {
property: 'whiteSpace'
// cssProperty: 'whiteSpace',
}
})
export const TYPOGRAPHY = compose(styledSystem.typography, whiteSpace)
export interface SystemTypographyProps extends styledSystem.TypographyProps {
whiteSpace?: 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line'
}
// Border props
export const BORDER = compose(styledSystem.border, styledSystem.shadow)
export interface SystemBorderProps extends styledSystem.BorderProps, styledSystem.ShadowProps {}
// Layout props
export const LAYOUT = styledSystem.layout
export type SystemLayoutProps = styledSystem.LayoutProps