CustomizeThemeOptions.jsx 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { createSubscribedElement } from '../../UnstatedUtils';
  4. import AppContainer from '../../../services/AppContainer';
  5. import ThemeColorBox from './ThemeColorBox';
  6. import AdminCustomizeContainer from '../../../services/AdminCustomizeContainer';
  7. class CustomizeThemeOptions extends React.Component {
  8. render() {
  9. const { adminCustomizeContainer } = this.props;
  10. const { currentLayout, currentTheme } = adminCustomizeContainer.state;
  11. const lightNDarkTheme = [{
  12. name: 'default', bg: '#ffffff', topbar: '#334455', theme: '#112744',
  13. }, {
  14. name: 'mono-blue', bg: '#F7FBFD', topbar: '#00587A', theme: '#00587A',
  15. }];
  16. const uniqueTheme = [{
  17. name: 'nature', bg: '#f9fff3', topbar: '#118050', theme: '#460039',
  18. }, {
  19. name: 'wood', bg: '#fffefb', topbar: '#aaa45f', theme: '#dddebf',
  20. }, {
  21. name: 'island', bg: '#8ecac0', topbar: '#0c2a44', theme: '#cef2ef',
  22. }, {
  23. name: 'christmas', bg: '#fffefb', topbar: '#b3000c', theme: '#017e20',
  24. }, {
  25. name: 'antarctic', bg: '#ffffff', topbar: '#000080', theme: '#99cccc',
  26. }, {
  27. name: 'spring', bg: '#fff5ee', topbar: '#ff69b4', theme: '#ffb6c1',
  28. }, {
  29. name: 'future', bg: '#16282D', topbar: '#011414', theme: '#04B4AE',
  30. }, {
  31. name: 'halloween', bg: '#030003', topbar: '#cc5d1f', theme: '#e9af2b',
  32. }];
  33. return (
  34. <div id="themeOptions" className={`${currentLayout === 'kibela' && 'disabled'}`}>
  35. {/* Light and Dark Themes */}
  36. <div>
  37. <h3>Light and dark modes</h3>
  38. <div className="d-flex flex-wrap">
  39. {lightNDarkTheme.map((theme) => {
  40. return (
  41. <ThemeColorBox
  42. key={theme.name}
  43. isSelected={currentTheme === theme.name}
  44. onSelected={() => adminCustomizeContainer.switchThemeType(theme.name)}
  45. name={theme.name}
  46. bg={theme.bg}
  47. topbar={theme.topbar}
  48. theme={theme.theme}
  49. />
  50. );
  51. })}
  52. </div>
  53. </div>
  54. {/* Unique Theme */}
  55. <div>
  56. <h3>Only one mode</h3>
  57. <div className="d-flex flex-wrap">
  58. {uniqueTheme.map((theme) => {
  59. return (
  60. <ThemeColorBox
  61. key={theme.name}
  62. isSelected={currentTheme === theme.name}
  63. onSelected={() => adminCustomizeContainer.switchThemeType(theme.name)}
  64. name={theme.name}
  65. bg={theme.bg}
  66. topbar={theme.topbar}
  67. theme={theme.theme}
  68. />
  69. );
  70. })}
  71. </div>
  72. </div>
  73. </div>
  74. );
  75. }
  76. }
  77. const CustomizeThemeOptionsWrapper = (props) => {
  78. return createSubscribedElement(CustomizeThemeOptions, props, [AppContainer, AdminCustomizeContainer]);
  79. };
  80. CustomizeThemeOptions.propTypes = {
  81. appContainer: PropTypes.instanceOf(AppContainer).isRequired,
  82. adminCustomizeContainer: PropTypes.instanceOf(AdminCustomizeContainer).isRequired,
  83. };
  84. export default CustomizeThemeOptionsWrapper;