Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

reducer.js 1.9KB

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