Header.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { bindActionCreators } from 'redux';
  4. import { connect } from 'react-redux';
  5. import styled from 'styled-components';
  6. import HeaderLogo from './HeaderLogo';
  7. import HeaderLeftMenu from './HeaderLeftMenu';
  8. import HeaderRightMenu from './HeaderRightMenu';
  9. import { showPageLoading } from '../../actions';
  10. const Wrapper = styled.header`
  11. display: flex;
  12. width: 1232px;
  13. max-width: 100%;
  14. padding: 0 32px;
  15. height: 102px;
  16. justify-content: space-between;
  17. align-items: center;
  18. @media only screen and (max-width: 768px) {
  19. height: auto;
  20. align-items: flex-start;
  21. padding: 16px;
  22. margin-bottom: 32px;
  23. }
  24. `;
  25. const LeftMenuWrapper = styled.div`
  26. display: flex;
  27. @media only screen and (max-width: 488px) {
  28. flex-direction: column;
  29. }
  30. `;
  31. const Header = props => (
  32. <Wrapper>
  33. <LeftMenuWrapper>
  34. <HeaderLogo showPageLoading={props.showPageLoading} />
  35. <HeaderLeftMenu />
  36. </LeftMenuWrapper>
  37. <HeaderRightMenu showPageLoading={props.showPageLoading} />
  38. </Wrapper>
  39. );
  40. Header.propTypes = {
  41. showPageLoading: PropTypes.func.isRequired,
  42. };
  43. const mapDispatchToProps = dispatch => ({
  44. showPageLoading: bindActionCreators(showPageLoading, dispatch),
  45. });
  46. export default connect(null, mapDispatchToProps)(Header);