_components.textbook__sidebar-right.scss 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /**
  2. * Styling for within-page navigation.
  3. *
  4. * [1]: When the screen is large enough to hold the sidebar, place the sidebar
  5. * offset a bit off the right side of the screen.
  6. *
  7. * [2]: When the screen is large enough that the page content itself starts
  8. * having margins, use a semi-hack to position the sidebar just the right
  9. * offset from the center of the screen to be in the correct spot. We're
  10. * aiming to have the sidebar positioned just to the right of the page
  11. * content which means we take the page width without the sidebar, divide it
  12. * by 2, and add padding.
  13. */
  14. /* [2] */
  15. .sidebar__right > * {
  16. direction: ltr;
  17. }
  18. aside.sidebar__right {
  19. // Positioning
  20. overflow-x: hidden;
  21. background-color: $book-background-color;
  22. overflow-y: auto;
  23. max-height: 90vh; // Required for scrolling to work properly
  24. scrollbar-width: thin;
  25. direction: rtl;
  26. // Font and look
  27. font-family: -apple-system, BlinkMacSystemFont, 'Roboto', 'Segoe UI',
  28. 'Helvetica Neue', 'Lucida Grande', Arial, sans-serif;
  29. color: #7a8288;
  30. border-left: 1px solid #c3c3c3;
  31. text-transform: uppercase;
  32. letter-spacing: 1px;
  33. // Show/hide navbar underneath
  34. nav {
  35. transition: opacity .25s ease-in-out, height .25s ease-in-out;
  36. -moz-transition: opacity .25s ease-in-out, height .25s ease-in-out;
  37. -webkit-transition: opacity .25s ease-in-out, height .25s ease-in-out;
  38. overflow-y: hidden;
  39. opacity: 0;
  40. height: 0px;
  41. @include mq($from: desktop) {
  42. opacity: 100;
  43. height: auto;
  44. }
  45. @include mq($from: laptop) {
  46. &.no_sidebar_content {
  47. opacity: 100;
  48. height: auto;
  49. }
  50. }
  51. }
  52. &:hover nav {
  53. opacity: 100;
  54. height: auto;
  55. }
  56. }
  57. h4.nav__title {
  58. color: #7a8288;
  59. margin: 0;
  60. padding: 0.5rem 1rem;
  61. font-family: -apple-system, BlinkMacSystemFont, 'Roboto', 'Segoe UI',
  62. 'Helvetica Neue', 'Lucida Grande', Arial, sans-serif;
  63. font-size: 0.8em;
  64. font-weight: bold;
  65. }
  66. ul.toc__menu {
  67. margin: 0;
  68. padding: 0;
  69. width: 100%;
  70. list-style: none;
  71. font-size: 0.8rem;
  72. }
  73. ul.toc__menu a {
  74. display: block;
  75. padding: 0.25rem .75rem;
  76. color: #898c8f;
  77. font-size: 0.8em;
  78. font-weight: bold;
  79. line-height: 1.5;
  80. }
  81. .toc__menu ul {
  82. margin-left: 0px;
  83. }
  84. .toc__menu li ul {
  85. li {
  86. list-style-type: none;
  87. padding-left: 18px;
  88. }
  89. a {
  90. font-weight: normal;
  91. padding: 0.25rem .5rem;
  92. }
  93. }
  94. // Active sidebar entries
  95. nav.onthispage li.active a {
  96. color: #0077d8;
  97. }
  98. li.active {
  99. border-left: 1px solid #0077d8;
  100. margin-left: -1px;
  101. }