Spaces:
Sleeping
Sleeping
File size: 1,006 Bytes
56fda74 |
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 |
import { Theme } from '@emotion/react'
import styled from './base'
import { ReactJSXIntrinsicElements } from './jsx-namespace'
import { tags } from './tags'
import {
CreateStyledComponent,
CreateStyled as BaseCreateStyled
} from './types'
export type {
ArrayInterpolation,
ComponentSelector,
CSSObject,
FunctionInterpolation,
Interpolation
} from '@emotion/serialize'
export type {
CreateStyledComponent,
FilteringStyledOptions,
StyledComponent,
StyledOptions
} from './types'
export type StyledTags = {
[Tag in keyof ReactJSXIntrinsicElements]: CreateStyledComponent<
{
theme?: Theme
as?: React.ElementType
},
ReactJSXIntrinsicElements[Tag]
>
}
export interface CreateStyled extends BaseCreateStyled, StyledTags {}
// bind it to avoid mutating the original function
const newStyled = styled.bind(null) as CreateStyled
tags.forEach(tagName => {
;(newStyled as any)[tagName] = newStyled(tagName as keyof typeof newStyled)
})
export default newStyled
|