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.

reducer.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // @flow
  2. import { ReducerRegistry } from '../base/redux';
  3. import {
  4. SET_FILMSTRIP_ENABLED,
  5. SET_FILMSTRIP_VISIBLE,
  6. SET_HORIZONTAL_VIEW_DIMENSIONS,
  7. SET_TILE_VIEW_DIMENSIONS
  8. } from './actionTypes';
  9. const DEFAULT_STATE = {
  10. /**
  11. * The indicator which determines whether the {@link Filmstrip} is enabled.
  12. *
  13. * @public
  14. * @type {boolean}
  15. */
  16. enabled: true,
  17. /**
  18. * The horizontal view dimensions.
  19. *
  20. * @public
  21. * @type {Object}
  22. */
  23. horizontalViewDimensions: {},
  24. /**
  25. * The tile view dimensions.
  26. *
  27. * @public
  28. * @type {Object}
  29. */
  30. tileViewDimensions: {},
  31. /**
  32. * The indicator which determines whether the {@link Filmstrip} is visible.
  33. *
  34. * @public
  35. * @type {boolean}
  36. */
  37. visible: true
  38. };
  39. ReducerRegistry.register(
  40. 'features/filmstrip',
  41. (state = DEFAULT_STATE, action) => {
  42. switch (action.type) {
  43. case SET_FILMSTRIP_ENABLED:
  44. return {
  45. ...state,
  46. enabled: action.enabled
  47. };
  48. case SET_FILMSTRIP_VISIBLE:
  49. return {
  50. ...state,
  51. visible: action.visible
  52. };
  53. case SET_HORIZONTAL_VIEW_DIMENSIONS:
  54. return {
  55. ...state,
  56. horizontalViewDimensions: action.dimensions
  57. };
  58. case SET_TILE_VIEW_DIMENSIONS:
  59. return {
  60. ...state,
  61. tileViewDimensions: action.dimensions
  62. };
  63. }
  64. return state;
  65. });