Header.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. align-items: flex-start;
  30. }
  31. `;
  32. const Header = props => (
  33. <Wrapper>
  34. <LeftMenuWrapper>
  35. <HeaderLogo showPageLoading={props.showPageLoading} />
  36. <HeaderLeftMenu />
  37. </LeftMenuWrapper>
  38. <HeaderRightMenu showPageLoading={props.showPageLoading} />
  39. </Wrapper>
  40. );
  41. Header.propTypes = {
  42. showPageLoading: PropTypes.func.isRequired,
  43. };
  44. const mapDispatchToProps = dispatch => ({
  45. showPageLoading: bindActionCreators(showPageLoading, dispatch),
  46. });
  47. export default connect(
  48. null,
  49. mapDispatchToProps
  50. )(Header);