|
| 1 | +import { useContext, ContextType } from 'react' |
| 2 | +import { ThemeContext } from 'styled-components/native' |
| 3 | +import { createUseGetter } from '@xstyled/core' |
| 4 | +import { th } from '@xstyled/system' |
| 5 | + |
| 6 | +export const useTheme = (): ContextType<typeof ThemeContext> => { |
| 7 | + return useContext(ThemeContext) |
| 8 | +} |
| 9 | + |
| 10 | +export const useTh = createUseGetter(th, useTheme) |
| 11 | + |
| 12 | +export const useAngle = createUseGetter(th.angle, useTheme) |
| 13 | +export const useAnimation = createUseGetter(th.animation, useTheme) |
| 14 | +export const useBorder = createUseGetter(th.border, useTheme) |
| 15 | +export const useBorderColor = createUseGetter(th.borderColor, useTheme) |
| 16 | +export const useBorderStyle = createUseGetter(th.borderStyle, useTheme) |
| 17 | +export const useBorderWidth = createUseGetter(th.borderWidth, useTheme) |
| 18 | +export const useColor = createUseGetter(th.color, useTheme) |
| 19 | +export const useDuration = createUseGetter(th.duration, useTheme) |
| 20 | +export const useFont = createUseGetter(th.font, useTheme) |
| 21 | +export const useFontSize = createUseGetter(th.fontSize, useTheme) |
| 22 | +export const useFontWeight = createUseGetter(th.fontWeight, useTheme) |
| 23 | +export const useInset = createUseGetter(th.inset, useTheme) |
| 24 | +export const useLetterSpacing = createUseGetter(th.letterSpacing, useTheme) |
| 25 | +export const useLineHeight = createUseGetter(th.lineHeight, useTheme) |
| 26 | +export const usePercent = createUseGetter(th.percent, useTheme) |
| 27 | +export const usePx = createUseGetter(th.px, useTheme) |
| 28 | +export const useRadius = createUseGetter(th.radius, useTheme) |
| 29 | +export const useRingWidth = createUseGetter(th.ringWidth, useTheme) |
| 30 | +export const useShadow = createUseGetter(th.shadow, useTheme) |
| 31 | +export const useSize = createUseGetter(th.size, useTheme) |
| 32 | +export const useSpace = createUseGetter(th.space, useTheme) |
| 33 | +export const useTimingFunction = createUseGetter(th.timingFunction, useTheme) |
| 34 | +export const useTransform = createUseGetter(th.transform, useTheme) |
| 35 | +export const useTransition = createUseGetter(th.transition, useTheme) |
| 36 | +export const useTransitionProperty = createUseGetter( |
| 37 | + th.transitionProperty, |
| 38 | + useTheme, |
| 39 | +) |
| 40 | +export const useZIndex = createUseGetter(th.zIndex, useTheme) |
0 commit comments