Guest User

Untitled

a guest
Dec 18th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. import React from "react";
  2. import styled from "styled-components";
  3.  
  4. const Container = styled.div`
  5. /* make it full height and width */
  6. position: absolute;
  7. top: 0;
  8. right: 0;
  9. bottom: 0;
  10. left: 0;
  11.  
  12. /* layout three rows: navbar, content, and footer */
  13. display: grid;
  14. grid-template-rows: auto 1fr auto;
  15. `;
  16.  
  17. const Navbar = styled.nav`
  18. background: darkred;
  19.  
  20. /* center the inner container */
  21. display: flex;
  22. justify-content: center;
  23. `;
  24.  
  25. const NavbarContainer = styled.div`
  26. background: red;
  27.  
  28. /* as wide as it can be, but not too wide */
  29. width: 100%;
  30. max-width: 480px;
  31. `;
  32.  
  33. const Content = styled.div`
  34. background: darkblue;
  35.  
  36. /* center the inner container */
  37. display: flex;
  38. justify-content: center;
  39. `;
  40.  
  41. const ContentContainer = styled.div`
  42. background: blue;
  43.  
  44. /* as wide as it can be, but not too wide */
  45. width: 100%;
  46. max-width: 480px;
  47. `;
  48.  
  49. const Footer = styled.footer`
  50. background: grey;
  51.  
  52. /* make footer stick to the bottom */
  53. grid-row-start: 3;
  54. grid-row-end: 4;
  55.  
  56. /* center the inner container */
  57. display: flex;
  58. justify-content: center;
  59. `;
  60.  
  61. const FooterContainer = styled.div`
  62. background: darkgrey;
  63.  
  64. /* as wide as it can be, but not too wide */
  65. width: 100%;
  66. max-width: 480px;
  67. `;
  68.  
  69. export default () => (
  70. <Container>
  71. <Navbar>
  72. <NavbarContainer>Nav stuff here</NavbarContainer>
  73. </Navbar>
  74. <Content>
  75. <ContentContainer>Content stuff here</ContentContainer>
  76. </Content>
  77. <Footer>
  78. <FooterContainer>My footer here</FooterContainer>
  79. </Footer>
  80. </Container>
  81. );
Add Comment
Please, Sign In to add comment