toolbar.scss 11 KB

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