toolbar.scss 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. @import '../../abstracts/variables';
  2. :root {
  3. --toolbar-border-color: var(--neutral-80);
  4. --toolbar-header-bg-color: var(--neutral-90);
  5. --toolbar-header-btn-border-color: var(--neutral-80);
  6. --toolbar-btn-color: var(--white);
  7. --toolbar-btn-hover-bg-color: var(--neutral-80);
  8. --toolbar-btn-hover-color: var(--white);
  9. --toolbar-btn-active-color: var(--white);
  10. --toolbar-btn-active-bg-color: var(--green-50);
  11. --toolbar-height: #{$toolbar-height};
  12. --toolbar-small-height: #{$toolbar-small-height};
  13. --toolbar-alt-bg-color: var(--neutral-80);
  14. --formatting-btn-color: var(--white);
  15. --formatting-btn-bg: var(--neutral-80);
  16. --formatting-btn-border: var(--neutral-70);
  17. --project-name-color: var(--neutral-40);
  18. --toolbar-filetree-bg-color: var(--neutral-80);
  19. --project-rename-link-color: var(--neutral-40);
  20. --project-rename-link-color-hover: var(--neutral-20);
  21. --editor-header-logo-background: url(../../../../public/img/ol-brand/overleaf-o-white.svg)
  22. center / contain no-repeat;
  23. --editor-toolbar-bg: var(--neutral-80);
  24. --toolbar-dropdown-divider-color: var(--border-dark-divider);
  25. }
  26. .ide-redesign-main {
  27. --toolbar-alt-bg-color: var(--bg-dark-secondary);
  28. --toolbar-btn-color: var(--content-primary-dark);
  29. --toolbar-btn-hover-bg-color: var(--neutral-80);
  30. --toolbar-btn-hover-color: var(--white);
  31. --editor-toolbar-bg: var(--bg-dark-primary);
  32. --toolbar-filetree-bg-color: var(--neutral-80);
  33. .ol-cm-toolbar-portal {
  34. display: flex;
  35. align-items: center;
  36. background-color: var(--editor-toolbar-bg);
  37. .review-panel-header {
  38. align-self: flex-start;
  39. }
  40. }
  41. .ol-cm-toolbar-wrapper {
  42. flex: 1;
  43. width: 100%;
  44. }
  45. .ol-cm-toolbar-wrapper-indented {
  46. width: calc(100% - var(--review-panel-width));
  47. }
  48. }
  49. @include theme('light') {
  50. --toolbar-border-color: var(--neutral-20);
  51. --toolbar-header-bg-color: var(--white);
  52. --toolbar-header-btn-border-color: var(--neutral-20);
  53. --toolbar-btn-color: var(--neutral-70);
  54. --toolbar-btn-hover-bg-color: var(--neutral-10);
  55. --toolbar-btn-hover-color: var(--neutral-70);
  56. --toolbar-btn-active-bg-color: var(--green-50);
  57. --toolbar-alt-bg-color: var(--white);
  58. --formatting-btn-color: var(--neutral-70);
  59. --formatting-btn-bg: transparent;
  60. --formatting-btn-border: var(--neutral-20);
  61. --project-name-color: var(--neutral-70);
  62. --toolbar-filetree-bg-color: var(--white);
  63. --project-rename-link-color: var(--neutral-70);
  64. --project-rename-link-color-hover: var(--neutral-70);
  65. --editor-header-logo-background: url(../../../../public/img/ol-brand/overleaf-o.svg)
  66. center / contain no-repeat;
  67. --editor-toolbar-bg: var(--white);
  68. --toolbar-dropdown-divider-color: var(--border-divider);
  69. .ide-redesign-main {
  70. --toolbar-alt-bg-color: var(--bg-light-secondary);
  71. --toolbar-btn-color: var(--content-primary);
  72. --toolbar-btn-hover-bg-color: var(--neutral-80);
  73. --toolbar-btn-hover-color: var(--white);
  74. --editor-toolbar-bg: var(--white);
  75. --toolbar-filetree-bg-color: var(--white);
  76. }
  77. }
  78. .toolbar {
  79. display: flex;
  80. align-items: center;
  81. height: var(--toolbar-height);
  82. border-bottom: 1px solid var(--toolbar-border-color);
  83. button {
  84. position: relative;
  85. .badge {
  86. position: absolute;
  87. top: 0;
  88. right: 0;
  89. pointer-events: none; // Labels were capturing button/anchor clicks.
  90. .badge-content {
  91. padding: 0;
  92. }
  93. }
  94. }
  95. .toolbar-right,
  96. .toolbar-left {
  97. button:not(.back-to-editor-btn) {
  98. background: transparent;
  99. box-shadow: none;
  100. }
  101. }
  102. .toolbar-right .back-to-editor-btn {
  103. margin-right: var(--spacing-09);
  104. display: flex;
  105. align-items: center;
  106. .toolbar-label {
  107. margin-bottom: 0;
  108. }
  109. }
  110. > a:not(.btn),
  111. > button,
  112. .toolbar-left > a:not(.btn),
  113. .toolbar-left > button,
  114. .toolbar-right > a:not(.btn),
  115. .toolbar-right > button:not(.back-to-editor-btn) {
  116. display: inline-block;
  117. color: var(--toolbar-btn-color);
  118. background-color: transparent;
  119. padding: var(--spacing-01);
  120. line-height: 1;
  121. height: 24px;
  122. border-radius: var(--border-radius-base);
  123. &.toolbar-header-back-projects {
  124. padding: var(--spacing-02) var(--spacing-04) var(--spacing-02);
  125. margin-bottom: var(--spacing-01);
  126. }
  127. &:hover {
  128. text-shadow: none;
  129. color: var(--toolbar-btn-hover-color);
  130. background-color: transparent;
  131. text-decoration: none;
  132. }
  133. &.active,
  134. &:active {
  135. .label {
  136. display: none;
  137. }
  138. color: white;
  139. background-color: var(--bg-info-01);
  140. box-shadow: none;
  141. &:hover {
  142. color: white;
  143. }
  144. }
  145. }
  146. a.btn-full-height,
  147. button.btn-full-height {
  148. border: none;
  149. border-radius: 0;
  150. border-right: 1px solid var(--toolbar-header-btn-border-color);
  151. color: var(--toolbar-btn-color);
  152. padding: var(--spacing-02) var(--spacing-05) var(--spacing-03);
  153. font-size: var(--font-size-05);
  154. max-height: 39px;
  155. &:hover {
  156. text-shadow: none;
  157. background-color: var(--toolbar-btn-hover-bg-color);
  158. color: var(--toolbar-btn-color);
  159. }
  160. &.active,
  161. &:active {
  162. color: var(--white);
  163. background-color: $bg-accent-01;
  164. box-shadow: none;
  165. }
  166. .badge {
  167. top: var(--spacing-01);
  168. right: var(--spacing-02);
  169. }
  170. .spinner-border {
  171. vertical-align: middle;
  172. font-size: var(--font-size-02);
  173. }
  174. &.dropdown-toggle {
  175. line-height: 1;
  176. &::after {
  177. vertical-align: middle;
  178. font-size: var(--font-size-02);
  179. }
  180. }
  181. }
  182. .toolbar-left {
  183. display: flex;
  184. align-items: stretch;
  185. float: left;
  186. text-align: center;
  187. }
  188. .toolbar-right {
  189. display: flex;
  190. align-items: stretch;
  191. flex-grow: 1;
  192. justify-content: flex-end;
  193. a.btn-full-height,
  194. button.btn-full-height {
  195. border-right: 0;
  196. border-left: 1px solid var(--toolbar-header-btn-border-color);
  197. }
  198. }
  199. .toolbar-center {
  200. text-align: center;
  201. text-overflow: ellipsis;
  202. overflow: hidden;
  203. // At small screen sizes, center relative to the left menu and right buttons
  204. width: 100%;
  205. display: flex;
  206. justify-content: center;
  207. }
  208. &.toolbar-header {
  209. align-items: stretch;
  210. background-color: var(--toolbar-header-bg-color);
  211. position: absolute;
  212. top: 0;
  213. left: 0;
  214. right: 0;
  215. z-index: 1;
  216. }
  217. .toolbar-item {
  218. display: flex;
  219. justify-content: center;
  220. }
  221. }
  222. .layout-dropdown .dropdown-item {
  223. align-items: center;
  224. }
  225. .toolbar-label {
  226. display: none;
  227. margin: 0 var(--spacing-02);
  228. font-size: var(--font-size-02);
  229. font-weight: 600;
  230. vertical-align: middle;
  231. text-align: left;
  232. @include media-breakpoint-up(lg) {
  233. display: inline-block;
  234. }
  235. &.toolbar-label-multiline {
  236. line-height: 1.1;
  237. }
  238. }
  239. .toolbar-filetree {
  240. @include toolbar-sm-height;
  241. background-color: var(--toolbar-filetree-bg-color);
  242. padding: 0 var(--spacing-03);
  243. flex-shrink: 0;
  244. }
  245. .toolbar-editor {
  246. height: var(--toolbar-small-height);
  247. background-color: var(--editor-toolbar-bg);
  248. padding: 0 5px;
  249. overflow: hidden;
  250. position: relative;
  251. z-index: 10; // Prevent track changes showing over toolbar
  252. }
  253. /**************************************
  254. Toggle Switch
  255. ***************************************/
  256. .toggle-switch {
  257. --toggle-switch-height: 26px;
  258. --toggle-switch-padding: var(--spacing-01);
  259. display: inline-flex;
  260. align-items: center;
  261. height: var(--toggle-switch-height);
  262. margin-right: var(--spacing-03);
  263. border-radius: var(--border-radius-full);
  264. background-color: var(--bg-tertiary-themed);
  265. padding: var(--toggle-switch-padding);
  266. }
  267. .toggle-switch-label {
  268. display: inline-block;
  269. float: left;
  270. font-weight: normal;
  271. // It seems we need to set the height explicitly rather than using 100% to get the button to display correctly in Blink
  272. height: calc(var(--toggle-switch-height) - 2 * var(--toggle-switch-padding));
  273. text-align: center;
  274. margin: 0;
  275. cursor: pointer;
  276. user-select: none;
  277. color: var(--content-secondary-themed);
  278. border-radius: var(--border-radius-full);
  279. transition:
  280. color 0.12s ease-out,
  281. background-color 0.12s ease-out,
  282. box-shadow 0.12s ease-out;
  283. overflow: hidden;
  284. span {
  285. display: flex;
  286. align-items: center;
  287. height: 100%;
  288. width: 100%;
  289. padding: 0 var(--spacing-08);
  290. background-size: 200% 100%;
  291. background-position: 0 0;
  292. transition: background-position 0.12s ease-out;
  293. font-size: var(--font-size-02);
  294. font-weight: bold;
  295. }
  296. }
  297. .toggle-switch-input {
  298. @include visually-hidden;
  299. }
  300. .toggle-switch-input:disabled + .toggle-switch-label {
  301. cursor: not-allowed;
  302. }
  303. .toggle-switch-input:checked + .toggle-switch-label {
  304. span {
  305. background-position: -100% 0;
  306. }
  307. color: var(--white);
  308. background-color: var(--bg-accent-01);
  309. border-radius: var(--border-radius-full);
  310. box-shadow: 0 2px 4px rgb(30 37 48 / 16%);
  311. }
  312. .toggle-switch-input:checked:nth-child(2) + .toggle-switch-label {
  313. span {
  314. background-position: 100% 0;
  315. }
  316. }
  317. .editor-toggle-switch {
  318. display: flex;
  319. align-items: center;
  320. white-space: nowrap;
  321. .toggle-switch {
  322. margin-left: var(--spacing-03);
  323. }
  324. .toggle-switch-label span {
  325. background: none;
  326. transition: background 0.12s ease-out;
  327. }
  328. .toggle-switch-label:first-of-type span {
  329. padding-left: var(--spacing-04);
  330. }
  331. .toggle-switch-label:last-of-type span {
  332. padding-right: var(--spacing-04);
  333. border-right: none;
  334. }
  335. }
  336. /**************************************
  337. Formatting buttons
  338. ***************************************/
  339. .formatting-btn {
  340. color: var(--formatting-btn-color);
  341. background-color: var(--formatting-btn-bg);
  342. padding: 0;
  343. height: 100%;
  344. display: flex;
  345. align-items: center;
  346. justify-content: center;
  347. box-shadow: none;
  348. border: none;
  349. border-left: 1px solid var(--formatting-btn-border);
  350. border-radius: 0;
  351. &:hover {
  352. color: var(--formatting-btn-color);
  353. }
  354. &.active {
  355. color: var(--white);
  356. background-color: var(--toolbar-btn-active-bg-color);
  357. box-shadow: none;
  358. &:focus {
  359. color: var(--toolbar-btn-active-color);
  360. &:not(:focus-visible) {
  361. outline: none;
  362. }
  363. }
  364. }
  365. &:focus {
  366. color: var(--formatting-btn-color);
  367. }
  368. }
  369. .formatting-btn-icon {
  370. min-width: 32px;
  371. width: 32px;
  372. }
  373. .formatting-btn-icon:last-of-type {
  374. border-right: 1px solid var(--formatting-btn-border);
  375. }
  376. .try-new-editor-button {
  377. .button-content {
  378. gap: var(--spacing-02);
  379. }
  380. }