itizawa 6 лет назад
Родитель
Сommit
d34fcb1c6d
1 измененных файлов с 54 добавлено и 12 удалено
  1. 54 12
      src/client/js/components/Admin/Customize/CustomizeThemeOptions.jsx

+ 54 - 12
src/client/js/components/Admin/Customize/CustomizeThemeOptions.jsx

@@ -11,24 +11,66 @@ import AdminCustomizeContainer from '../../../services/AdminCustomizeContainer';
 class CustomizeThemeOptions extends React.Component {
 class CustomizeThemeOptions extends React.Component {
 
 
   render() {
   render() {
+    const { adminCustomizeContainer } = this.props;
+    const { currentTheme } = adminCustomizeContainer.state;
+
+    const lightTheme = [{
+      name: 'default', bg: '#ffffff', topbar: '#334455', theme: '#112744',
+    }, {
+      name: 'nature', bg: '#f9fff3', topbar: '#118050', theme: '#460039',
+    }, {
+      name: 'mono-blue', bg: '#F7FBFD', topbar: '#00587A', theme: '#00587A',
+    }, {
+      name: 'wood', bg: '#fffefb', topbar: '#aaa45f', theme: '#dddebf',
+    }, {
+      name: 'island', bg: '#8ecac0', topbar: '#0c2a44', theme: '#cef2ef',
+    }, {
+      name: 'christmas', bg: '#fffefb', topbar: '#b3000c', theme: '#017e20',
+    }, {
+      name: 'antarctic', bg: '#ffffff', topbar: '#000080', theme: '#99cccc',
+    }];
+
+    const darkTheme = [{
+      name: 'default-dark', bg: '#212731', topbar: '#151515', theme: '#f75b36',
+    }, {
+      name: 'future', bg: '#16282D', topbar: '#011414', theme: '#04B4AE',
+    }, {
+      name: 'blue-night', bg: '#061F2F', topbar: '#27343B', theme: '#0090C8',
+    }, {
+      name: 'halloween', bg: '#030003', topbar: '#cc5d1f', theme: '#e9af2b',
+    }];
+
     return (
     return (
-      <div id="themeOptions" className={`${this.props.adminCustomizeContainer.state.currentLayout === 'kibela' && 'disabled'}`}>
+      <div id="themeOptions" className={`${adminCustomizeContainer.state.currentLayout === 'kibela' && 'disabled'}`}>
         {/* Light Themes  */}
         {/* Light Themes  */}
         <div className="d-flex">
         <div className="d-flex">
-          <ThemeColorBox name="default" bg="#ffffff" topbar="#334455" theme="#112744" />
-          <ThemeColorBox name="nature" bg="#f9fff3" topbar="#118050" theme="#460039" />
-          <ThemeColorBox name="mono-blue" bg="#F7FBFD" topbar="#00587A" theme="#00587A" />
-          <ThemeColorBox name="wood" bg="#fffefb" topbar="#aaa45f" theme="#dddebf" />
-          <ThemeColorBox name="island" bg="#8ecac0" topbar="#0c2a44" theme="#cef2ef" />
-          <ThemeColorBox name="christmas" bg="#fffefb" topbar="#b3000c" theme="#017e20" />
-          <ThemeColorBox name="antarctic" bg="#ffffff" topbar="#000080" theme="#99cccc" />
+          {lightTheme.map((theme) => {
+            return (
+              <ThemeColorBox
+                isSelected={currentTheme === theme.name}
+                onSelected={() => adminCustomizeContainer.switchThemeType(theme.name)}
+                name={theme.name}
+                bg={theme.bg}
+                topbar={theme.topbar}
+                theme={theme.theme}
+              />
+            );
+          })}
         </div>
         </div>
         {/* Dark Themes  */}
         {/* Dark Themes  */}
         <div className="d-flex mt-3">
         <div className="d-flex mt-3">
-          <ThemeColorBox name="default-dark" bg="#212731" topbar="#151515" theme="#f75b36" />
-          <ThemeColorBox name="future" bg="#16282D" topbar="#011414" theme="#04B4AE" />
-          <ThemeColorBox name="blue-night" bg="#061F2F" topbar="#27343B" theme="#0090C8" />
-          <ThemeColorBox name="halloween" bg="#030003" topbar="#cc5d1f" theme="#e9af2b" />
+          {darkTheme.map((theme) => {
+            return (
+              <ThemeColorBox
+                isSelected={currentTheme === theme.name}
+                onSelected={() => adminCustomizeContainer.switchThemeType(theme.name)}
+                name={theme.name}
+                bg={theme.bg}
+                topbar={theme.topbar}
+                theme={theme.theme}
+              />
+            );
+          })}
         </div>
         </div>
       </div>
       </div>
     );
     );