import envSchema from '../config/schema/env';
import { COLORS_DEV, COLORS_PROD } from '../constants/colors';
import { Config as AntdConfig } from 'ui/elements';

const env = envSchema.parse(process.env);

let colors = COLORS_DEV;
if (env.USE_DEV_COLORS) {
  colors = COLORS_DEV;
} else {
  colors = COLORS_PROD;
}

const withTheme = (node: JSX.Element) => (
  <AntdConfig
    theme={{
      token: {
        borderRadius: 2,
        borderRadiusLG: 2,
        colorLink: colors.COLOR_PRIMARY,
        colorPrimary: colors.COLOR_PRIMARY,
      },
    }}
  >
    {node}
  </AntdConfig>
);

export default withTheme;
