_page-editor.scss 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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. }
  10. .side-panel-open {
  11. @apply w-overflow-y-hidden sm:w-overflow-y-auto;
  12. }
  13. // An object is the basic wrapper around any field or group of fields in the editor interface
  14. .object {
  15. @include nice-padding();
  16. position: relative;
  17. &:first-child {
  18. border: 0;
  19. }
  20. &.focused {
  21. border-color: $color-input-focus-border;
  22. }
  23. fieldset,
  24. .field-row {
  25. padding-top: $object-title-height + 12px;
  26. }
  27. fieldset {
  28. padding-inline-start: 0;
  29. padding-inline-end: 0;
  30. .field-row {
  31. padding-top: 0;
  32. }
  33. }
  34. .object-help {
  35. display: block;
  36. position: relative;
  37. z-index: 1;
  38. top: $object-title-height;
  39. margin-top: 0;
  40. margin-bottom: -1em;
  41. padding: 1em math.div($grid-gutter-width, 2) 1em 3em;
  42. opacity: 1;
  43. .icon-help {
  44. margin-inline-start: -1.75em;
  45. }
  46. }
  47. &:hover .object-help {
  48. opacity: 1;
  49. }
  50. > .title-wrapper {
  51. box-sizing: border-box;
  52. height: $object-title-height;
  53. -webkit-font-smoothing: auto;
  54. background: $color-salmon-light;
  55. color: $color-text-base;
  56. padding: 0.9em 0 0.9em 5em;
  57. font-size: 0.95em;
  58. margin: 0;
  59. line-height: 1.5em;
  60. font-weight: normal;
  61. position: absolute;
  62. top: 0;
  63. inset-inline-start: 0;
  64. inset-inline-end: 0;
  65. z-index: 1;
  66. overflow: hidden;
  67. label {
  68. display: inline;
  69. font-weight: inherit;
  70. float: none;
  71. width: auto;
  72. color: inherit;
  73. font-size: inherit;
  74. }
  75. &:before {
  76. @include font-smoothing;
  77. text-shadow: none;
  78. font-family: $font-wagtail-icons;
  79. // UI Redesign: To be removed in page editor redesign
  80. content: map.get($icons, 'arrow-down');
  81. text-align: center;
  82. display: block;
  83. position: absolute;
  84. z-index: 2;
  85. font-size: 2em;
  86. top: 0;
  87. line-height: 1.8em;
  88. inset-inline-start: 0;
  89. width: $desktop-nice-padding;
  90. color: $color-white;
  91. padding: 0;
  92. margin: 0;
  93. background-color: $color-salmon;
  94. }
  95. }
  96. &.required {
  97. > .title-wrapper label:after {
  98. content: '*';
  99. color: theme('colors.critical.200');
  100. font-weight: bold;
  101. display: inline-block;
  102. margin-inline-start: 0.5em;
  103. line-height: 1em;
  104. font-size: 13px;
  105. }
  106. }
  107. // Special full-width, one-off fields i.e a single text or textarea input
  108. &.full {
  109. fieldset {
  110. display: block;
  111. float: none;
  112. }
  113. li {
  114. padding: 0;
  115. }
  116. .error-message {
  117. @include nice-padding();
  118. padding-bottom: 2em;
  119. }
  120. .error,
  121. .error input:not([type='submit']),
  122. .error textarea {
  123. background-color: $color-input-error-bg;
  124. }
  125. }
  126. // cursory styling for streamfield. Main styling in client/src/components/StreamField/StreamField.scss
  127. &.block_field {
  128. padding-inline-start: 20px;
  129. padding-inline-end: 20px;
  130. .object-layout_big-part {
  131. max-width: 100%;
  132. }
  133. fieldset {
  134. padding-bottom: 0;
  135. max-width: unset;
  136. // Workaround to make sure blocks do not overflow horizontally.
  137. min-width: 0;
  138. }
  139. .block_field > .field-content {
  140. width: 100%;
  141. }
  142. }
  143. // special panel for the publishing fields, requires a bit more pizzazz
  144. &.publishing {
  145. > .title-wrapper:before {
  146. // UI Redesign: To be removed in page editor redesign
  147. content: map.get($icons, 'date');
  148. font-size: 1.8rem;
  149. line-height: 1.4em;
  150. width: 1.4em;
  151. }
  152. }
  153. .multiple {
  154. padding: 4.5em 0 0;
  155. fieldset {
  156. padding-top: 0;
  157. padding-bottom: 0;
  158. }
  159. }
  160. .fields {
  161. max-width: 100%;
  162. }
  163. // removes top padding from multiples used within another panel
  164. .fields .multiple {
  165. padding-top: 0;
  166. }
  167. .add {
  168. padding-top: 1em;
  169. }
  170. &.empty {
  171. border-bottom: 1px solid $color-white;
  172. > h3 {
  173. margin: 0;
  174. border-bottom: 1px solid $color-white;
  175. }
  176. // wrapper around add button for multiple objects. Default version is wordless plus button for contracted groups of fields
  177. .add {
  178. @include transition(background-color 0.2s ease);
  179. position: relative;
  180. z-index: 2;
  181. top: 0;
  182. inset-inline-start: 0;
  183. width: 3.3em;
  184. padding: 0;
  185. margin: 0 0 0 -20px;
  186. cursor: pointer;
  187. .button {
  188. border-radius: 0;
  189. overflow: visible;
  190. background-color: $color-salmon-light;
  191. font-size: 0; // helps fake the effect of t.ext-replace class, which can't be used here.
  192. width: 2em;
  193. // stylelint-disable max-nesting-depth
  194. &:before {
  195. position: relative;
  196. padding: 0;
  197. line-height: 1.8em; // specific height required as parent 'a' has no height
  198. font-size: 1.4rem;
  199. width: 1.8em;
  200. background-color: $color-salmon;
  201. }
  202. }
  203. }
  204. .multiple {
  205. padding: 0;
  206. }
  207. }
  208. &.collapsible {
  209. // li.collapsed gets its height from the fieldset only, which is now hidden
  210. // and h2 has position: absolute which doesn't add to it either, so it would be 0 without this
  211. min-height: 41px;
  212. .title-wrapper {
  213. &:before {
  214. // UI Redesign: To be removed in page editor redesign
  215. content: map.get($icons, 'collapse-up');
  216. cursor: pointer;
  217. }
  218. }
  219. &.collapsed {
  220. .title-wrapper {
  221. &:before {
  222. // UI Redesign: To be removed in page editor redesign
  223. content: map.get($icons, 'collapse-down');
  224. }
  225. }
  226. }
  227. }
  228. }
  229. // Custom styles that make some fields look more important
  230. .full {
  231. input:not([type='submit']),
  232. textarea {
  233. @include nice-padding;
  234. border-radius: 0;
  235. padding-top: 1.5em;
  236. padding-bottom: 1.5em;
  237. font-size: 1.2em;
  238. line-height: 1.6em;
  239. }
  240. }
  241. .title {
  242. input:not([type='submit']),
  243. textarea {
  244. font-size: 2em;
  245. font-family: $font-sans;
  246. font-weight: 800;
  247. }
  248. }
  249. // Footer control bar for performing actions on the page
  250. footer .actions,
  251. footer .preview {
  252. .button {
  253. @apply w-leading-none w-inline-flex w-items-center;
  254. .icon {
  255. margin-inline-end: theme('spacing.2');
  256. }
  257. }
  258. }
  259. footer .actions {
  260. .button {
  261. font-weight: 600;
  262. text-overflow: ellipsis;
  263. }
  264. }
  265. footer .preview {
  266. button,
  267. .button {
  268. padding: 0 1em;
  269. @include media-breakpoint-down(xs) {
  270. width: 100%;
  271. margin-top: 2px;
  272. margin-bottom: 2px;
  273. height: 3em;
  274. }
  275. background-color: $color-grey-2;
  276. border-color: $color-grey-2;
  277. }
  278. .dropdown {
  279. input[type='button'],
  280. input[type='submit'],
  281. button,
  282. .button {
  283. background-color: $color-grey-2;
  284. border-color: $color-grey-2;
  285. }
  286. ul,
  287. .dropdown-toggle {
  288. background-color: $color-grey-2;
  289. }
  290. &.open > .button + .dropdown-toggle {
  291. background-color: $color-grey-2;
  292. }
  293. }
  294. }
  295. @include media-breakpoint-up(sm) {
  296. .object {
  297. fieldset {
  298. // Override column mixin for column items.
  299. display: block;
  300. // Override column mixin for column items.
  301. float: none;
  302. max-width: 1024px;
  303. padding-inline-start: 0;
  304. padding-inline-end: 0;
  305. fieldset {
  306. width: 100%;
  307. }
  308. }
  309. .object-layout {
  310. display: flex;
  311. flex-flow: row-reverse wrap;
  312. &_small-part {
  313. flex: 1 0 0;
  314. }
  315. &_big-part {
  316. flex: 5 0 0;
  317. }
  318. }
  319. .object-help {
  320. padding-bottom: 40px;
  321. margin-inline-start: 10px;
  322. margin-bottom: 0;
  323. opacity: 0;
  324. }
  325. &.block_field {
  326. .object-help {
  327. padding-inline-start: 6.4em;
  328. }
  329. }
  330. &.full {
  331. fieldset {
  332. // Override column mixin for column items.
  333. display: block;
  334. // Override column mixin for column items.
  335. float: none;
  336. margin-inline-start: -51px;
  337. padding: 0;
  338. padding-top: $object-title-height;
  339. }
  340. input:not([type='submit']),
  341. textarea {
  342. border-width: 0 1px;
  343. }
  344. .field {
  345. padding: 0;
  346. }
  347. .field-content {
  348. display: block;
  349. float: none;
  350. width: auto;
  351. padding: inherit;
  352. }
  353. }
  354. .multiple {
  355. @include column(10);
  356. padding-inline-start: 0;
  357. padding-inline-end: 0;
  358. > li {
  359. padding: 1em 10em 1em 1.5em;
  360. }
  361. }
  362. &.empty .add {
  363. margin: 0 0 0 -50px;
  364. }
  365. }
  366. // Make room for comments on the right when enabled
  367. .tab-content--comments-enabled .object {
  368. padding-inline-end: 27%;
  369. &.full {
  370. padding-inline-end: 36%;
  371. }
  372. @include media-breakpoint-up(lg) {
  373. padding-inline-end: 30%;
  374. &.full {
  375. padding-inline-end: 36%;
  376. }
  377. }
  378. }
  379. }
  380. // Media for Windows High Contrast
  381. @media (forced-colors: $media-forced-colours) {
  382. .object {
  383. border-top: 1px solid GrayText;
  384. .object-help {
  385. margin-bottom: 0;
  386. }
  387. }
  388. }