_page-editor.scss 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. @use 'sass:color';
  2. @use 'sass:map';
  3. @use 'sass:math';
  4. .page-editor {
  5. .content-wrapper {
  6. margin-bottom: 10em;
  7. overflow-x: hidden;
  8. }
  9. .breadcrumb {
  10. margin: -1.2em 0 2em; // sass linter complains about $desktop-nice-padding here because of unit mismatch
  11. padding-inline-start: calc(#{$desktop-nice-padding} - 2em);
  12. @include media-breakpoint-up(sm) {
  13. margin-top: -1.8em;
  14. margin-inline-start: -$desktop-nice-padding;
  15. margin-inline-end: -$desktop-nice-padding;
  16. }
  17. }
  18. .modal .breadcrumb {
  19. margin: 0;
  20. padding-inline-start: 0.5em;
  21. background-color: transparent;
  22. .breadcrumb-item {
  23. padding-inline-start: 0;
  24. padding-inline-end: 0;
  25. }
  26. a {
  27. color: $color-grey-2;
  28. padding-inline-start: 0.5em;
  29. padding-inline-end: 0.5em;
  30. &:hover {
  31. color: $color-white;
  32. }
  33. }
  34. li:hover {
  35. background-color: transparent;
  36. }
  37. .home_icon {
  38. margin-inline-start: 0;
  39. }
  40. div.c-dropdown__button.u-btn-current {
  41. color: $color-grey-2;
  42. &:hover {
  43. background-color: transparent;
  44. cursor: default;
  45. }
  46. }
  47. .status-tag {
  48. margin-bottom: 0;
  49. }
  50. .u-link {
  51. color: $color-white;
  52. }
  53. }
  54. .header-meta {
  55. list-style: none;
  56. margin-top: 0;
  57. margin-bottom: 0;
  58. padding: 0;
  59. li {
  60. border: 0;
  61. float: left;
  62. height: 1.5em;
  63. line-height: 2em;
  64. margin: 1em 0.75em 1.5em 0;
  65. .icon {
  66. @include svg-icon(1.25em, text-bottom);
  67. margin-inline-end: 0.2em;
  68. }
  69. .icon-warning {
  70. @include svg-icon();
  71. }
  72. &:first-child .button {
  73. margin-inline-start: -0.8em;
  74. }
  75. .avatar {
  76. margin-inline-start: 0;
  77. }
  78. }
  79. .button {
  80. font-size: 1em;
  81. font-weight: 600;
  82. margin-top: -0.25em; // Account for the button border
  83. overflow: initial;
  84. height: 2.5em;
  85. line-height: 2.5em;
  86. }
  87. .human-readable-date {
  88. display: inline;
  89. }
  90. &--status {
  91. padding-inline-end: 0.8em;
  92. }
  93. &--type {
  94. padding: 0 0.8em;
  95. }
  96. }
  97. .form-side {
  98. @apply w-absolute
  99. w-z-[90]
  100. w-right-0
  101. w-top-full
  102. w-w-full
  103. w-h-screen
  104. sm:w-max-w-[420px]
  105. w-transform
  106. w-translate-x-full
  107. w-px-5
  108. w-py-10
  109. md:w-p-10
  110. w-bg-white
  111. w-box-border
  112. w-transition
  113. w-duration-300
  114. w-border-l
  115. w-border-grey-100
  116. w-overflow-y-auto
  117. w-scrollbar-thin;
  118. &--open {
  119. @apply w-translate-x-0;
  120. }
  121. &__close-button {
  122. @apply w-text-primary w-absolute w-left-2 w-top-2 hover:w-text-primary-200 w-bg-white w-p-2.5 w-hidden w-transition;
  123. .icon {
  124. @apply w-w-4 w-h-4;
  125. }
  126. }
  127. &--open .form-side__close-button,
  128. &--open .form-side__panel {
  129. @apply w-block;
  130. }
  131. &__panel {
  132. @apply w-hidden w-pl-2.5;
  133. }
  134. }
  135. }
  136. .side-panel-open {
  137. @apply w-overflow-y-hidden sm:w-overflow-y-auto;
  138. }
  139. // An object is the basic wrapper around any field or group of fields in the editor interface
  140. .object {
  141. @include nice-padding();
  142. position: relative;
  143. &:first-child {
  144. border: 0;
  145. }
  146. &.focused {
  147. border-color: $color-input-focus-border;
  148. }
  149. fieldset,
  150. .field-row {
  151. padding-top: $object-title-height + 12px;
  152. }
  153. fieldset {
  154. padding-inline-start: 0;
  155. padding-inline-end: 0;
  156. .field-row {
  157. padding-top: 0;
  158. }
  159. }
  160. .object-help {
  161. display: block;
  162. position: relative;
  163. z-index: 1;
  164. top: $object-title-height;
  165. margin-top: 0;
  166. margin-bottom: -1em;
  167. padding: 1em math.div($grid-gutter-width, 2) 1em 3em;
  168. opacity: 1;
  169. .icon-help {
  170. margin-inline-start: -1.75em;
  171. }
  172. }
  173. &:hover .object-help {
  174. opacity: 1;
  175. }
  176. > .title-wrapper {
  177. box-sizing: border-box;
  178. height: $object-title-height;
  179. -webkit-font-smoothing: auto;
  180. background: $color-salmon-light;
  181. color: #200200;
  182. padding: 0.9em 0 0.9em 5em;
  183. font-size: 0.95em;
  184. margin: 0;
  185. line-height: 1.5em;
  186. font-weight: normal;
  187. position: absolute;
  188. top: 0;
  189. inset-inline-start: 0;
  190. inset-inline-end: 0;
  191. z-index: 1;
  192. overflow: hidden;
  193. label {
  194. display: inline;
  195. font-weight: inherit;
  196. float: none;
  197. width: auto;
  198. color: inherit;
  199. font-size: inherit;
  200. }
  201. &:before {
  202. @include font-smoothing;
  203. text-shadow: none;
  204. font-family: $font-wagtail-icons;
  205. // UI Redesign: To be removed in page editor redesign
  206. content: map.get($icons, 'arrow-down');
  207. text-align: center;
  208. display: block;
  209. position: absolute;
  210. z-index: 2;
  211. font-size: 2em;
  212. top: 0;
  213. line-height: 1.8em;
  214. inset-inline-start: 0;
  215. width: $desktop-nice-padding;
  216. color: $color-white;
  217. padding: 0;
  218. margin: 0;
  219. background-color: $color-salmon;
  220. }
  221. }
  222. &.required {
  223. > .title-wrapper label:after {
  224. content: '*';
  225. color: $color-red;
  226. font-weight: bold;
  227. display: inline-block;
  228. margin-inline-start: 0.5em;
  229. line-height: 1em;
  230. font-size: 13px;
  231. }
  232. }
  233. // Special full-width, one-off fields i.e a single text or textarea input
  234. &.full {
  235. fieldset {
  236. display: block;
  237. float: none;
  238. }
  239. li {
  240. padding: 0;
  241. }
  242. .error-message {
  243. @include nice-padding();
  244. padding-bottom: 2em;
  245. }
  246. .error,
  247. .error input:not([type='submit']),
  248. .error textarea {
  249. background-color: $color-input-error-bg;
  250. }
  251. }
  252. // cursory styling for streamfield. Main styling in client/src/components/StreamField/StreamField.scss
  253. &.block_field {
  254. padding-inline-start: 20px;
  255. padding-inline-end: 20px;
  256. .object-layout_big-part {
  257. max-width: 100%;
  258. }
  259. fieldset {
  260. padding-bottom: 0;
  261. max-width: unset;
  262. // Workaround to make sure blocks do not overflow horizontally.
  263. min-width: 0;
  264. }
  265. .block_field > .field-content {
  266. width: 100%;
  267. }
  268. }
  269. // special panel for the publishing fields, requires a bit more pizzazz
  270. &.publishing {
  271. > .title-wrapper:before {
  272. // UI Redesign: To be removed in page editor redesign
  273. content: map.get($icons, 'date');
  274. font-size: 1.8rem;
  275. line-height: 1.4em;
  276. width: 1.4em;
  277. }
  278. }
  279. &.privacy {
  280. > .title-wrapper:before {
  281. // UI Redesign: To be removed in page editor redesign
  282. content: map.get($icons, 'view');
  283. }
  284. }
  285. .multiple {
  286. padding: 4.5em 0 0;
  287. fieldset {
  288. padding-top: 0;
  289. padding-bottom: 0;
  290. }
  291. }
  292. .fields {
  293. max-width: 100%;
  294. }
  295. // removes top padding from multiples used within another panel
  296. .fields .multiple {
  297. padding-top: 0;
  298. }
  299. .add {
  300. padding-top: 1em;
  301. }
  302. &.empty {
  303. border-bottom: 1px solid $color-white;
  304. > h3 {
  305. margin: 0;
  306. border-bottom: 1px solid $color-white;
  307. }
  308. // wrapper around add button for multiple objects. Default version is wordless plus button for contracted groups of fields
  309. .add {
  310. @include transition(background-color 0.2s ease);
  311. position: relative;
  312. z-index: 2;
  313. top: 0;
  314. inset-inline-start: 0;
  315. width: 3.3em;
  316. padding: 0;
  317. margin: 0 0 0 -20px;
  318. cursor: pointer;
  319. .button {
  320. border-radius: 0;
  321. overflow: visible;
  322. background-color: $color-salmon-light;
  323. font-size: 0; // helps fake the effect of t.ext-replace class, which can't be used here.
  324. width: 2em;
  325. // stylelint-disable max-nesting-depth
  326. &:before {
  327. position: relative;
  328. padding: 0;
  329. line-height: 1.8em; // specific height required as parent 'a' has no height
  330. font-size: 1.4rem;
  331. width: 1.8em;
  332. background-color: $color-salmon;
  333. }
  334. &:hover:before {
  335. background-color: color.adjust($color-salmon, $lightness: -5%);
  336. }
  337. }
  338. }
  339. .multiple {
  340. padding: 0;
  341. }
  342. }
  343. &.collapsible {
  344. // li.collapsed gets its height from the fieldset only, which is now hidden
  345. // and h2 has position: absolute which doesn't add to it either, so it would be 0 without this
  346. min-height: 41px;
  347. .title-wrapper {
  348. &:before {
  349. // UI Redesign: To be removed in page editor redesign
  350. content: map.get($icons, 'collapse-up');
  351. cursor: pointer;
  352. }
  353. }
  354. &.collapsed {
  355. .title-wrapper {
  356. &:before {
  357. // UI Redesign: To be removed in page editor redesign
  358. content: map.get($icons, 'collapse-down');
  359. }
  360. }
  361. }
  362. }
  363. }
  364. // Custom styles that make some fields look more important
  365. .full {
  366. input:not([type='submit']),
  367. textarea {
  368. @include nice-padding;
  369. border-radius: 0;
  370. padding-top: 1.5em;
  371. padding-bottom: 1.5em;
  372. font-size: 1.2em;
  373. line-height: 1.6em;
  374. }
  375. }
  376. .title {
  377. input:not([type='submit']),
  378. textarea {
  379. font-size: 2em;
  380. font-family: $font-sans;
  381. font-weight: 800;
  382. }
  383. }
  384. // Footer control bar for performing actions on the page
  385. footer .actions,
  386. footer .preview {
  387. .button {
  388. @apply w-leading-none w-inline-flex w-items-center;
  389. .icon {
  390. @apply w-pr-2;
  391. }
  392. }
  393. }
  394. footer .actions {
  395. .button {
  396. font-weight: 600;
  397. text-overflow: ellipsis;
  398. }
  399. }
  400. footer .preview {
  401. button,
  402. .button {
  403. padding: 0 1em;
  404. @include media-breakpoint-down(xs) {
  405. width: 100%;
  406. margin-top: 2px;
  407. margin-bottom: 2px;
  408. height: 3em;
  409. }
  410. background-color: color.adjust($color-grey-2, $lightness: 10%);
  411. border-color: color.adjust($color-grey-2, $lightness: 10%);
  412. &:hover {
  413. background-color: $color-grey-2;
  414. border-color: $color-grey-2;
  415. }
  416. }
  417. .dropdown {
  418. input[type='button'],
  419. input[type='submit'],
  420. button,
  421. .button {
  422. background-color: color.adjust($color-grey-2, $lightness: 10%);
  423. border-color: color.adjust($color-grey-2, $lightness: 10%);
  424. &:hover {
  425. background-color: $color-grey-2;
  426. border-color: $color-grey-2;
  427. }
  428. }
  429. ul,
  430. .dropdown-toggle {
  431. background-color: color.adjust($color-grey-2, $lightness: 10%);
  432. }
  433. .dropdown-toggle:hover,
  434. &.open > .button + .dropdown-toggle {
  435. background-color: $color-grey-2;
  436. }
  437. }
  438. }
  439. @include media-breakpoint-up(sm) {
  440. .object {
  441. fieldset {
  442. // Override column mixin for column items.
  443. display: block;
  444. // Override column mixin for column items.
  445. float: none;
  446. max-width: 1024px;
  447. padding-inline-start: 0;
  448. padding-inline-end: 0;
  449. fieldset {
  450. width: 100%;
  451. }
  452. }
  453. .object-layout {
  454. display: flex;
  455. flex-flow: row-reverse wrap;
  456. &_small-part {
  457. flex: 1 0 0;
  458. }
  459. &_big-part {
  460. flex: 5 0 0;
  461. }
  462. }
  463. .object-help {
  464. padding-bottom: 40px;
  465. margin-inline-start: 10px;
  466. margin-bottom: 0;
  467. opacity: 0;
  468. }
  469. &.block_field {
  470. .object-help {
  471. padding-inline-start: 6.4em;
  472. }
  473. }
  474. &.full {
  475. fieldset {
  476. // Override column mixin for column items.
  477. display: block;
  478. // Override column mixin for column items.
  479. float: none;
  480. margin-inline-start: -51px;
  481. padding: 0;
  482. padding-top: $object-title-height;
  483. }
  484. input:not([type='submit']),
  485. textarea {
  486. border-width: 0 1px;
  487. }
  488. .field {
  489. padding: 0;
  490. }
  491. .field-content {
  492. display: block;
  493. float: none;
  494. width: auto;
  495. padding: inherit;
  496. }
  497. }
  498. .multiple {
  499. @include column(10);
  500. padding-inline-start: 0;
  501. padding-inline-end: 0;
  502. > li {
  503. padding: 1em 10em 1em 1.5em;
  504. }
  505. }
  506. &.empty .add {
  507. margin: 0 0 0 -50px;
  508. }
  509. }
  510. // Make room for comments on the right when enabled
  511. .tab-content--comments-enabled .object {
  512. padding-inline-end: 27%;
  513. &.full {
  514. padding-inline-end: 36%;
  515. }
  516. @include media-breakpoint-up(lg) {
  517. padding-inline-end: 30%;
  518. &.full {
  519. padding-inline-end: 36%;
  520. }
  521. }
  522. }
  523. }
  524. // Media for Windows High Contrast
  525. @media (forced-colors: $media-forced-colours) {
  526. .object {
  527. border-top: 1px solid GrayText;
  528. .object-help {
  529. margin-bottom: 0;
  530. }
  531. }
  532. }