_layout.scss 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. $side-padding:3em;
  2. body, html{
  3. position: relative;
  4. width: 100%;
  5. height:100%;
  6. font-family: sans-serif;
  7. font-style: normal;
  8. margin:0;
  9. padding:0;
  10. }
  11. body{
  12. overflow:hidden;
  13. }
  14. #root{
  15. display: flex;
  16. flex-direction: column;
  17. width: 100vw;
  18. max-width: 1920px;
  19. height:100vh;
  20. // ? https://www.bram.us/2020/05/06/100vh-in-safari-on-ios/
  21. @supports (-webkit-touch-callout: none) {
  22. height: -webkit-fill-available;
  23. }
  24. margin:0 auto;
  25. %layout-element{
  26. width:100vw;
  27. max-width: 1920px;
  28. box-sizing:border-box;
  29. }
  30. header[role="banner"]{
  31. z-index:10;
  32. flex: 0 0 auto;
  33. @extend %layout-element;
  34. padding:1em $side-padding 1em $side-padding;
  35. @media only screen and (max-width: $small-bp), (orientation: portrait) {
  36. padding:1em $side-padding/2 0 $side-padding/2;
  37. }
  38. }
  39. section[role="main-content"]{
  40. display: flex;
  41. flex:1 1 auto;
  42. @extend %layout-element;
  43. overflow: hidden;
  44. position: relative;
  45. >.wrapper{
  46. position: relative;
  47. padding:0 $side-padding 0 $side-padding;
  48. // height:100%; max-height:100%;
  49. display: flex;
  50. flex: 1;
  51. overflow-y: hidden;
  52. overflow-x: hidden;
  53. >*{
  54. @include fade-transition;
  55. }
  56. @media only screen and (max-width: $small-bp), (orientation: portrait) {
  57. overflow-y: auto;
  58. padding:0 $side-padding/2 0 $side-padding/2;
  59. }
  60. }
  61. .main-content-layout{
  62. position: relative;
  63. // https://stackoverflow.com/a/33644245
  64. display: flex;
  65. flex: 1;
  66. >section{
  67. max-height: 100%;
  68. }
  69. >header,
  70. >section>.wrapper,
  71. >nav{
  72. box-sizing: border-box;
  73. max-height: 100%;
  74. padding-top:$base-line;
  75. }
  76. >section>.wrapper,
  77. >nav{
  78. overflow-x: hidden;
  79. overflow-y: auto;
  80. -webkit-overflow-scrolling: touch;
  81. }
  82. }
  83. @media only screen and (max-width: $small-bp), (orientation: portrait) {
  84. .main-content-layout{
  85. display: flex;
  86. flex-direction: column;
  87. }
  88. }
  89. @media (orientation: portrait) {
  90. .main-content-layout{
  91. display: flex;
  92. flex-direction: column;
  93. flex-wrap: nowrap;
  94. }
  95. }
  96. }
  97. footer[role="tools"]{
  98. flex:0 0 auto;
  99. @extend %layout-element;
  100. // padding-bottom: 1em;
  101. // >*{
  102. // padding:0.5em 1em;
  103. // }
  104. }
  105. }