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. const darkTheme = [{
  27. name: 'default-dark', bg: '#212731', topbar: '#151515', theme: '#f75b36',
  28. }, {
  29. name: 'future', bg: '#16282D', topbar: '#011414', theme: '#04B4AE',
  30. }, {
  31. name: 'blue-night', bg: '#061F2F', topbar: '#27343B', theme: '#0090C8',
  32. }, {
  33. name: 'halloween', bg: '#030003', topbar: '#cc5d1f', theme: '#e9af2b',
  34. }];
  35. return (
  36. <div id="themeOptions" className={`${currentLayout === 'kibela' && 'disabled'}`}>
  37. {/* Light Themes */}
  38. <div className="d-flex">
  39. {lightTheme.map((theme) => {
  40. return (
  41. <ThemeColorBox
  42. isSelected={currentTheme === theme.name}
  43. onSelected={() => adminCustomizeContainer.switchThemeType(theme.name)}
  44. name={theme.name}
  45. bg={theme.bg}
  46. topbar={theme.topbar}
  47. theme={theme.theme}
  48. />
  49. );
  50. })}
  51. </div>
  52. {/* Dark Themes */}
  53. <div className="d-flex mt-3">
  54. {darkTheme.map((theme) => {
  55. return (
  56. <ThemeColorBox
  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;