Guest User

Untitled

a guest
Jan 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3.  
  4. import {
  5. H5,
  6. FilterContainer,
  7. } from './styles';
  8.  
  9. const filterLinks = [
  10. { name: 'All' },
  11. { name: 'Interactive' },
  12. { name: 'Branding' },
  13. { name: 'Film' },
  14. { name: 'Development' },
  15. ];
  16.  
  17. const Filter = ({ changeFilter, currentFilter, active, reveal }) => (
  18. <FilterContainer>
  19. { filterLinks.map((v, i) => (
  20. <H5
  21. key={ i }
  22. onClick={ changeFilter }
  23. active={
  24. (currentFilter || active) === v.name.toLowerCase()
  25. }
  26. reveal={ reveal }
  27. index={ i + 1 }
  28. >
  29. { v.name }
  30. </H5>
  31.  
  32. ))}
  33. </FilterContainer>);
  34.  
  35. Filter.defaultProps = {
  36. currentFilter: null,
  37. active: null,
  38. reveal: false,
  39. };
  40.  
  41. Filter.propTypes = {
  42. changeFilter: PropTypes.func.isRequired,
  43. currentFilter: PropTypes.string,
  44. active: PropTypes.string,
  45. reveal: PropTypes.bool,
  46. };
  47.  
  48. export default Filter;
Add Comment
Please, Sign In to add comment