CustomizeThemeOptions.jsx 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 lightTheme = [{
  12. name: 'default', bg: '#ffffff', topbar: '#334455', theme: '#112744',
  13. }, {
  14. name: 'nature', bg: '#f9fff3', topbar: '#118050', theme: '#460039',
  15. }, {
  16. name: 'mono-blue', bg: '#F7FBFD', topbar: '#00587A', theme: '#00587A',
  17. }, {
  18. name: 'wood', bg: '#fffefb', topbar: '#aaa45f', theme: '#dddebf',
  19. }, {
  20. name: 'island', bg: '#8ecac0', topbar: '#0c2a44', theme: '#cef2ef',
  21. }, {
  22. name: 'christmas', bg: '#fffefb', topbar: '#b3000c', theme: '#017e20',
  23. }, {
  24. name: 'antarctic', bg: '#ffffff', topbar: '#000080', theme: '#99cccc',
  25. }, {
  26. name: 'spring', bg: '#fff5ee', topbar: '#ff69b4', theme: '#ffb6c1',
  27. }];
  28. const darkTheme = [{
  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 Themes */}
  36. <div className="d-flex flex-wrap">
  37. {lightTheme.map((theme) => {
  38. return (
  39. <ThemeColorBox
  40. key={theme.name}
  41. isSelected={currentTheme === theme.name}
  42. onSelected={() => adminCustomizeContainer.switchThemeType(theme.name)}
  43. name={theme.name}
  44. bg={theme.bg}
  45. topbar={theme.topbar}
  46. theme={theme.theme}
  47. />
  48. );
  49. })}
  50. </div>
  51. {/* Dark Themes */}
  52. <div className="d-flex mt-3">
  53. {darkTheme.map((theme) => {
  54. return (
  55. <ThemeColorBox
  56. key={theme.name}
  57. isSelected={currentTheme === theme.name}
  58. onSelected={() => adminCustomizeContainer.switchThemeType(theme.name)}
  59. name={theme.name}
  60. bg={theme.bg}
  61. topbar={theme.topbar}
  62. theme={theme.theme}
  63. />
  64. );
  65. })}
  66. </div>
  67. </div>
  68. );
  69. }
  70. }
  71. const CustomizeThemeOptionsWrapper = (props) => {
  72. return createSubscribedElement(CustomizeThemeOptions, props, [AppContainer, AdminCustomizeContainer]);
  73. };
  74. CustomizeThemeOptions.propTypes = {
  75. appContainer: PropTypes.instanceOf(AppContainer).isRequired,
  76. adminCustomizeContainer: PropTypes.instanceOf(AdminCustomizeContainer).isRequired,
  77. };
  78. export default CustomizeThemeOptionsWrapper;