_layout.scss 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. // iphone
  39. @media only screen and (max-width: $iphone-bp), (orientation: portrait) {
  40. padding:1em $side-padding/2 1em $side-padding/2;
  41. }
  42. }
  43. section[role="main-content"]{
  44. display: flex;
  45. flex:1 1 auto;
  46. @extend %layout-element;
  47. overflow: hidden;
  48. position: relative;
  49. >.wrapper{
  50. position: relative;
  51. padding:0 $side-padding 0 $side-padding;
  52. // height:100%; max-height:100%;
  53. display: flex;
  54. flex: 1;
  55. overflow-y: hidden;
  56. overflow-x: hidden;
  57. >*{
  58. @include fade-transition;
  59. }
  60. @media only screen and (max-width: $small-bp), (orientation: portrait) {
  61. overflow-y: auto;
  62. padding:0 $side-padding/2 0 $side-padding/2;
  63. }
  64. // iphone
  65. @media only screen and (max-width: $iphone-bp), (orientation: portrait) {
  66. // padding:0 $side-padding/4 0 $side-padding/4;
  67. }
  68. }
  69. .main-content-layout{
  70. position: relative;
  71. // https://stackoverflow.com/a/33644245
  72. display: flex;
  73. flex: 1;
  74. >section{
  75. max-height: 100%;
  76. }
  77. >header,
  78. >section>.wrapper,
  79. >nav{
  80. box-sizing: border-box;
  81. max-height: 100%;
  82. padding-top:$base-line;
  83. }
  84. >section>.wrapper,
  85. >nav{
  86. overflow-x: hidden;
  87. overflow-y: auto;
  88. -webkit-overflow-scrolling: touch;
  89. }
  90. }
  91. @media only screen and (max-width: $small-bp), (orientation: portrait) {
  92. .main-content-layout{
  93. display: flex;
  94. flex-direction: column;
  95. }
  96. }
  97. @media (orientation: portrait) {
  98. .main-content-layout{
  99. display: flex;
  100. flex-direction: column;
  101. flex-wrap: nowrap;
  102. }
  103. }
  104. }
  105. footer[role="tools"]{
  106. flex:0 0 auto;
  107. @extend %layout-element;
  108. // padding-bottom: 1em;
  109. // >*{
  110. // padding:0.5em 1em;
  111. // }
  112. }
  113. }