// node modules
import { createContext, ReactNode } from 'react';
import { createTheming } from 'react-jss';

// local files
import { palette, Palette } from "./palette";
import { primaryButton, checkButton } from "./buttons";
import { typography } from "./typography";
import { font, Font } from "./font";

export type ThemeProps = {
    palette: Palette,
    font?: Record<string, Font>,
    primaryButton?: (prop: ThemeProps) => any,
    checkButton?: (prop: ThemeProps) => any,
    typography?: any
}

export type Theme = {
    theme: ThemeProps,
    adornmentEnd?: string | ReactNode,
    adornmentStart?: string | ReactNode
}

export const defaultTheme = {
    palette,
    font,
    primaryButton,
    checkButton,
    typography
}

const ThemeContext = createContext<ThemeProps>(defaultTheme);

export const theming = createTheming(ThemeContext);
