aboutsummaryrefslogtreecommitdiffstats
path: root/client/js/app/src/app/libs/theme-provider.jsx
blob: d7fe2b0c72a91435ad7f20858fc490746bf5e781 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
import React from 'react';
import { Global, MantineProvider } from '@mantine/core';
import { Colors } from 'app/styles/theme/colors';
import { styles } from 'app/styles/global';
import { getTheme } from 'app/styles/theme';

function setColorResolver(theme) {
  if (!theme.cr) theme.cr = new Colors(theme);
  return theme;
}

export function ThemeProvider({ children }) {
  return (
    <MantineProvider theme={getTheme()}>
      <Global styles={(theme) => styles(setColorResolver(theme))} />
      {children}
    </MantineProvider>
  );
}