You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.1 KiB

  1. // Package imports
  2. import React from 'react';
  3. import PropTypes from 'prop-types';
  4. import ImmutablePropTypes from 'react-immutable-proptypes';
  5. // Our imports
  6. import LocalSettingsPage from './page';
  7. import LocalSettingsNavigation from './navigation';
  8. // Stylesheet imports
  9. import './style';
  10. export default class LocalSettings extends React.PureComponent {
  11. static propTypes = {
  12. onChange: PropTypes.func.isRequired,
  13. onClose: PropTypes.func.isRequired,
  14. settings: ImmutablePropTypes.map.isRequired,
  15. };
  16. state = {
  17. currentIndex: 0,
  18. };
  19. navigateTo = (index) =>
  20. this.setState({ currentIndex: +index });
  21. render () {
  22. const { navigateTo } = this;
  23. const { onChange, onClose, settings } = this.props;
  24. const { currentIndex } = this.state;
  25. return (
  26. <div className='glitch modal-root__modal local-settings'>
  27. <LocalSettingsNavigation
  28. index={currentIndex}
  29. onClose={onClose}
  30. onNavigate={navigateTo}
  31. />
  32. <LocalSettingsPage
  33. index={currentIndex}
  34. onChange={onChange}
  35. settings={settings}
  36. />
  37. </div>
  38. );
  39. }
  40. }