Total Complexity | 0 |
Complexity/F | 0 |
Lines of Code | 41 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 100% |
Changes | 0 |
1 | 1 | import React, { CSSProperties } from "react"; |
|
2 | |||
3 | import { ThemeField } from "../../types"; |
||
4 | |||
5 | 1 | import { driveWithDarkMode } from "@cianciarusocataldo/modular-engine"; |
|
6 | |||
7 | 1 | import { Container } from "@cianciarusocataldo/modular-ui"; |
|
8 | |||
9 | 1 | const ThemedContainer = ({ |
|
10 | 5 | children, |
|
11 | 5 | style: inputStyle, |
|
12 | 5 | theme, |
|
13 | 5 | wrapper: inputWrapper, |
|
14 | }: { |
||
15 | children: JSX.Element; |
||
16 | style?: CSSProperties; |
||
17 | theme: ThemeField; |
||
18 | wrapper?: "div" | "header" | "footer"; |
||
19 | }) => { |
||
20 | 5 | const AppContainer = driveWithDarkMode(Container); |
|
21 | 5 | const style = theme.override || inputStyle; |
|
22 | 5 | const themeStyle = theme.style || {}; |
|
23 | 5 | const wrapper = inputWrapper || "div"; |
|
24 | |||
25 | 5 | return ( |
|
26 | <AppContainer |
||
27 | unstyled={Boolean(theme.className)} |
||
28 | wrapper={wrapper} |
||
29 | className={theme.className} |
||
30 | style={{ |
||
31 | ...style, |
||
32 | ...themeStyle, |
||
33 | }} |
||
34 | > |
||
35 | {children} |
||
36 | </AppContainer> |
||
37 | ); |
||
38 | }; |
||
39 | |||
40 | export default ThemedContainer; |
||
41 |