/
App.tsx
30 lines (27 loc) · 961 Bytes
/
App.tsx
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
import * as React from 'react';
import {Theme} from '@twilio-paste/theme';
import type {ThemeVariants} from '@twilio-paste/theme';
import {StylingGlobals, css} from '@twilio-paste/styling-library';
interface SelectedThemeContextProps {
selectedTheme: string;
setSelectedTheme: React.Dispatch<React.SetStateAction<string>>;
}
export const SelectedThemeContext = React.createContext<SelectedThemeContextProps>({} as SelectedThemeContextProps);
const App: React.FC = ({children}) => {
const [selectedTheme, setSelectedTheme] = React.useState('default');
return (
<SelectedThemeContext.Provider value={{selectedTheme, setSelectedTheme}}>
<Theme.Provider theme={selectedTheme as ThemeVariants}>
<StylingGlobals
styles={css({
body: {
overflow: 'hidden',
},
})}
/>
{children}
</Theme.Provider>
</SelectedThemeContext.Provider>
);
};
export default App;