toolbar.scss 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  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:focus,
  111. button:focus {
  112. outline: none;
  113. }
  114. > a:not(.btn),
  115. > button,
  116. .toolbar-left > a:not(.btn),
  117. .toolbar-left > button,
  118. .toolbar-right > a:not(.btn),
  119. .toolbar-right > button:not(.back-to-editor-btn) {
  120. display: inline-block;
  121. color: var(--toolbar-btn-color);
  122. background-color: transparent;
  123. padding: var(--spacing-01);
  124. line-height: 1;
  125. height: 24px;
  126. border-radius: var(--border-radius-base);
  127. &.toolbar-header-back-projects {
  128. padding: var(--spacing-02) var(--spacing-04) var(--spacing-02);
  129. margin-bottom: var(--spacing-01);
  130. }
  131. &:hover {
  132. text-shadow: none;
  133. color: var(--toolbar-btn-hover-color);
  134. background-color: transparent;
  135. text-decoration: none;
  136. }
  137. &.active,
  138. &:active {
  139. .label {
  140. display: none;
  141. }
  142. color: white;
  143. background-color: var(--bg-info-01);
  144. box-shadow: none;
  145. &:hover {
  146. color: white;
  147. }
  148. }
  149. }
  150. a.btn-full-height,
  151. button.btn-full-height {
  152. border: none;
  153. border-radius: 0;
  154. border-right: 1px solid var(--toolbar-header-btn-border-color);
  155. color: var(--toolbar-btn-color);
  156. padding: var(--spacing-02) var(--spacing-05) var(--spacing-03);
  157. font-size: var(--font-size-05);
  158. max-height: 39px;
  159. &:hover {
  160. text-shadow: none;
  161. background-color: var(--toolbar-btn-hover-bg-color);
  162. color: var(--toolbar-btn-color);
  163. }
  164. &.active,
  165. &:active {
  166. color: var(--white);
  167. background-color: $bg-accent-01;
  168. box-shadow: none;
  169. }
  170. .badge {
  171. top: var(--spacing-01);
  172. right: var(--spacing-02);
  173. }
  174. .spinner-border {
  175. vertical-align: middle;
  176. font-size: var(--font-size-02);
  177. }
  178. &.dropdown-toggle {
  179. line-height: 1;
  180. &::after {
  181. vertical-align: middle;
  182. font-size: var(--font-size-02);
  183. }
  184. }
  185. }
  186. .toolbar-left {
  187. display: flex;
  188. align-items: stretch;
  189. float: left;
  190. text-align: center;
  191. }
  192. .toolbar-right {
  193. display: flex;
  194. align-items: stretch;
  195. flex-grow: 1;
  196. justify-content: flex-end;
  197. a.btn-full-height,
  198. button.btn-full-height {
  199. border-right: 0;
  200. border-left: 1px solid var(--toolbar-header-btn-border-color);
  201. }
  202. }
  203. .toolbar-center {
  204. text-align: center;
  205. text-overflow: ellipsis;
  206. overflow: hidden;
  207. // At small screen sizes, center relative to the left menu and right buttons
  208. width: 100%;
  209. display: flex;
  210. justify-content: center;
  211. }
  212. &.toolbar-header {
  213. align-items: stretch;
  214. background-color: var(--toolbar-header-bg-color);
  215. position: absolute;
  216. top: 0;
  217. left: 0;
  218. right: 0;
  219. z-index: 1;
  220. }
  221. .toolbar-item {
  222. display: flex;
  223. justify-content: center;
  224. }
  225. }
  226. .layout-dropdown .dropdown-item {
  227. align-items: center;
  228. }
  229. .toolbar-label {
  230. display: none;
  231. margin: 0 var(--spacing-02);
  232. font-size: var(--font-size-02);
  233. font-weight: 600;
  234. vertical-align: middle;
  235. text-align: left;
  236. @include media-breakpoint-up(lg) {
  237. display: inline-block;
  238. }
  239. &.toolbar-label-multiline {
  240. line-height: 1.1;
  241. }
  242. }
  243. .toolbar-filetree {
  244. @include toolbar-sm-height;
  245. background-color: var(--toolbar-filetree-bg-color);
  246. padding: 0 var(--spacing-03);
  247. flex-shrink: 0;
  248. }
  249. .toolbar-editor {
  250. height: var(--toolbar-small-height);
  251. background-color: var(--editor-toolbar-bg);
  252. padding: 0 5px;
  253. overflow: hidden;
  254. position: relative;
  255. z-index: 10; // Prevent track changes showing over toolbar
  256. }
  257. /**************************************
  258. Toggle Switch
  259. ***************************************/
  260. .toggle-switch {
  261. --toggle-switch-height: 26px;
  262. --toggle-switch-padding: var(--spacing-01);
  263. display: inline-flex;
  264. align-items: center;
  265. height: var(--toggle-switch-height);
  266. margin-right: var(--spacing-03);
  267. border-radius: var(--border-radius-full);
  268. background-color: var(--bg-tertiary-themed);
  269. padding: var(--toggle-switch-padding);
  270. }
  271. .toggle-switch-label {
  272. display: inline-block;
  273. float: left;
  274. font-weight: normal;
  275. // It seems we need to set the height explicitly rather than using 100% to get the button to display correctly in Blink
  276. height: calc(var(--toggle-switch-height) - 2 * var(--toggle-switch-padding));
  277. text-align: center;
  278. margin: 0;
  279. cursor: pointer;
  280. user-select: none;
  281. color: var(--content-secondary-themed);
  282. border-radius: var(--border-radius-full);
  283. transition:
  284. color 0.12s ease-out,
  285. background-color 0.12s ease-out,
  286. box-shadow 0.12s ease-out;
  287. overflow: hidden;
  288. span {
  289. display: flex;
  290. align-items: center;
  291. height: 100%;
  292. width: 100%;
  293. padding: 0 var(--spacing-08);
  294. background-size: 200% 100%;
  295. background-position: 0 0;
  296. transition: background-position 0.12s ease-out;
  297. font-size: var(--font-size-02);
  298. font-weight: bold;
  299. }
  300. }
  301. .toggle-switch-input {
  302. @include visually-hidden;
  303. }
  304. .toggle-switch-input:disabled + .toggle-switch-label {
  305. cursor: not-allowed;
  306. }
  307. .toggle-switch-input:checked + .toggle-switch-label {
  308. span {
  309. background-position: -100% 0;
  310. }
  311. color: var(--white);
  312. background-color: var(--bg-accent-01);
  313. border-radius: var(--border-radius-full);
  314. box-shadow: 0 2px 4px rgb(30 37 48 / 16%);
  315. }
  316. .toggle-switch-input:checked:nth-child(2) + .toggle-switch-label {
  317. span {
  318. background-position: 100% 0;
  319. }
  320. }
  321. .editor-toggle-switch {
  322. display: flex;
  323. align-items: center;
  324. white-space: nowrap;
  325. .toggle-switch {
  326. margin-left: var(--spacing-03);
  327. }
  328. .toggle-switch-label span {
  329. background: none;
  330. transition: background 0.12s ease-out;
  331. }
  332. .toggle-switch-label:first-of-type span {
  333. padding-left: var(--spacing-04);
  334. }
  335. .toggle-switch-label:last-of-type span {
  336. padding-right: var(--spacing-04);
  337. border-right: none;
  338. }
  339. }
  340. /**************************************
  341. Formatting buttons
  342. ***************************************/
  343. .formatting-btn {
  344. color: var(--formatting-btn-color);
  345. background-color: var(--formatting-btn-bg);
  346. padding: 0;
  347. height: 100%;
  348. display: flex;
  349. align-items: center;
  350. justify-content: center;
  351. box-shadow: none;
  352. border: none;
  353. border-left: 1px solid var(--formatting-btn-border);
  354. border-radius: 0;
  355. &:hover {
  356. color: var(--formatting-btn-color);
  357. }
  358. &.active {
  359. color: var(--white);
  360. background-color: var(--toolbar-btn-active-bg-color);
  361. box-shadow: none;
  362. &:focus {
  363. color: var(--toolbar-btn-active-color);
  364. &:not(:focus-visible) {
  365. outline: none;
  366. }
  367. }
  368. }
  369. &:focus {
  370. color: var(--formatting-btn-color);
  371. }
  372. }
  373. .formatting-btn-icon {
  374. min-width: 32px;
  375. width: 32px;
  376. }
  377. .formatting-btn-icon:last-of-type {
  378. border-right: 1px solid var(--formatting-btn-border);
  379. }
  380. .try-new-editor-button {
  381. .button-content {
  382. gap: var(--spacing-02);
  383. }
  384. }