src/app/components/ThemedContainer/index.tsx
last analyzed

Complexity

Total Complexity 0
Complexity/F 0

Size

Lines of Code 41
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 0
eloc 32
mnd 0
bc 0
fnc 0
dl 0
loc 41
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
ccs 14
cts 14
cp 1
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