import { Theme } from '@emotion/react'; import styled, { StyledComponent } from '@emotion/styled'; import { createContext, DetailedHTMLProps, ElementType, HTMLAttributes, } from 'react'; import tw, { css } from 'twin.macro'; // eslint-disable-next-line @typescript-eslint/no-explicit-any type JsxPropsPlaceholder = any; type SC = StyledComponent< // eslint-disable-next-line @typescript-eslint/no-explicit-any { theme?: Theme; as?: ElementType }, DetailedHTMLProps, JsxPropsPlaceholder >; export type TypeStyles = { topLevel: number; H1: SC, HTMLHeadingElement>; H2: SC, HTMLHeadingElement>; H3: SC, HTMLHeadingElement>; Aside: SC, HTMLElement>; P: SC, HTMLParagraphElement>; }; const baseContext: TypeStyles = { topLevel: 1, H1: styled.h1(tw`text-h1 leading-tight md:(text-h1-md leading-snug)`), H2: styled.h2(tw`text-h2 leading-tight md:(text-h2-md leading-snug)`), H3: styled.h3(tw`text-h3 leading-tight md:(text-h3-md leading-snug)`), Aside: styled.aside(tw`text-lg font-serif`), P: styled.p(tw`text-base font-sans`), }; export interface StyleDefinition { skipLevels?: number; headings?: Array, HTMLHeadingElement>>; aside?: SC, HTMLElement>; p?: SC, HTMLParagraphElement>; } const TypeContext = createContext(baseContext); export default TypeContext;