_streamfield.scss 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. ul.sequence {
  2. @include clearfix;
  3. position: relative;
  4. }
  5. li.sequence-member {
  6. @include clearfix;
  7. position: relative;
  8. border: 1px solid transparent;
  9. border-width: 1px 0;
  10. &:hover {
  11. background-color: $color-input-focus;
  12. border-color: darken($color-input-focus, 10%);
  13. .sequence-member-inner {
  14. > .struct-block > label,
  15. > .char_field > label,
  16. .sequence > label {
  17. opacity: 1;
  18. }
  19. }
  20. }
  21. .struct-block .fields {
  22. @include column(10);
  23. padding-left: 0;
  24. padding-right: 0;
  25. }
  26. .struct-block .sequence-container {
  27. @include column(9);
  28. padding-left: 0;
  29. padding-right: 0;
  30. .sequence-member-inner {
  31. padding: 1.5em 0;
  32. }
  33. }
  34. // Copied from page-editor.scss
  35. .struct-block li.required > label:after {
  36. content: '*';
  37. color: $color-red;
  38. font-weight: bold;
  39. display: inline-block;
  40. margin-left: 0.5em;
  41. line-height: 1em;
  42. font-size: 13px;
  43. }
  44. // The top level sequence doesn't have a sequnce-member-inner. This block is basically for things that should only affect inner blocks
  45. .sequence-member-inner {
  46. @include clearfix;
  47. position: relative;
  48. padding: 1.5em 50px;
  49. .sequence-member {
  50. border: 0;
  51. }
  52. // sequences within sequences, such as a ListBlock within StructBlock
  53. > .sequence .sequence-inner {
  54. @include column(10);
  55. padding-left: 0;
  56. padding-right: 0;
  57. }
  58. .sequence-type-list .sequence-container-inner {
  59. @include column(10);
  60. padding-left: 0;
  61. padding-right: 0;
  62. }
  63. .sequence-type-list .sequence-member-inner {
  64. padding: 0;
  65. padding-top: 0.5em;
  66. padding-bottom: 1.2em;
  67. }
  68. }
  69. .fields > li {
  70. position: relative;
  71. }
  72. }
  73. .sequence-member__help {
  74. opacity: 0;
  75. .sequence-member:hover & {
  76. opacity: 1;
  77. }
  78. .icon-help-inverse {
  79. margin-right: 0.5em;
  80. }
  81. }
  82. // Image chooser as direct descendant of top-level streamfield has special display
  83. .sequence-member-inner > .widget-admin_image_chooser {
  84. label {
  85. display: none;
  86. }
  87. .field-content {
  88. display: block;
  89. float: none;
  90. width: 100%;
  91. text-align: center;
  92. max-width: 500px;
  93. margin: auto;
  94. border: 1px solid $color-grey-4;
  95. padding: 1em;
  96. }
  97. .chooser {
  98. .chosen {
  99. padding: 0;
  100. }
  101. .unchosen {
  102. &:before {
  103. float: none;
  104. font-size: 4em;
  105. margin: 0;
  106. }
  107. }
  108. .preview-image {
  109. float: none;
  110. margin: 0;
  111. }
  112. }
  113. .actions li {
  114. display: inline-block;
  115. float: none;
  116. }
  117. }
  118. // This horridly specific selector ensures text inputs, rich text fields and textareas
  119. // that are direct children of highest level sequence should be borderless and full-width
  120. .block_field > .field-content > .input > .sequence-container > .sequence-container-inner > .sequence > .sequence-member > .sequence-member-inner {
  121. > .widget-text_input input,
  122. > .halloeditor,
  123. > .widget-textarea textarea {
  124. padding: 0;
  125. max-width: 1024px;
  126. border: 0;
  127. background-color: transparent;
  128. }
  129. > .Draftail-Editor {
  130. padding: 0;
  131. max-width: 1024px;
  132. }
  133. }
  134. // Controls for ordering and deletion of items in a sequence
  135. .sequence-controls {
  136. @include transition(opacity 0.2s ease);
  137. border-radius: 2px 0 0;
  138. border: 1px solid darken($color-input-focus, 10%);
  139. border-width: 1px 1px 0;
  140. opacity: 0;
  141. visibility: hidden;
  142. position: absolute;
  143. top: -30px;
  144. right: 0;
  145. z-index: 1;
  146. overflow: visible;
  147. background-color: $color-input-focus;
  148. padding: 0 0 0 1em;
  149. height: 30px;
  150. h3 {
  151. margin: 0;
  152. font-size: 0.7rem;
  153. display: inline-block;
  154. margin-right: 1em;
  155. line-height: 1.8rem;
  156. label {
  157. color: $color-teal;
  158. font-weight: normal;
  159. text-transform: uppercase;
  160. float: none;
  161. width: auto;
  162. padding: 0;
  163. margin: 0;
  164. }
  165. }
  166. button.icon.text-replace {
  167. width: 1.8rem;
  168. height: 1.8rem;
  169. &:before {
  170. line-height: 1.3em;
  171. font-size: 0.9rem;
  172. }
  173. }
  174. // .buttons only exists for menus in stream_member.html
  175. .button-group {
  176. float: right;
  177. }
  178. &:hover .buttons,
  179. &:hover label {
  180. opacity: 1;
  181. }
  182. .disabled {
  183. display: none;
  184. }
  185. }
  186. // list controls are slightly different as they require closer proximity to their associated fields
  187. .list-controls {
  188. border-radius: 0;
  189. background: transparent;
  190. top: 1.5em;
  191. border: 0;
  192. padding: 0;
  193. overflow: hidden;
  194. height: auto;
  195. }
  196. // Menu of other blocks to be added at each position
  197. .stream-menu {
  198. @include transition(all 0.2s ease);
  199. box-shadow: inset 0 0 45px rgba(0, 0, 0, 0.3);
  200. position: relative;
  201. background-color: $color-grey-1;
  202. opacity: 1;
  203. .toggle {
  204. @include transition(color 0.2s ease);
  205. border-radius: 50px;
  206. position: absolute;
  207. top: -0.5em;
  208. left: 0;
  209. right: 0;
  210. margin: 0 auto;
  211. cursor: pointer;
  212. font-size: 1.7em;
  213. width: 1em;
  214. height: 1em;
  215. display: block;
  216. z-index: 1;
  217. color: $color-grey-1;
  218. background-color: $color-white;
  219. span {
  220. @include visuallyhidden();
  221. }
  222. &:before {
  223. transform: rotate(-45deg);
  224. position: absolute;
  225. font-family: wagtail;
  226. content: map-get($icons, 'plus-inverse');
  227. line-height: 1em;
  228. text-align: center;
  229. }
  230. }
  231. .stream-menu-inner {
  232. transform: translate3d(0, 0, 0);
  233. max-width: 50em;
  234. margin: auto;
  235. overflow: hidden;
  236. }
  237. ul {
  238. @include transition(all 0.2s ease);
  239. @include clearfix;
  240. transform: translate3d(0, 0, 0) scale(1);
  241. visibility: visible;
  242. opacity: 1;
  243. padding: 1em 1em 0;
  244. overflow: hidden;
  245. }
  246. li {
  247. @include column(3);
  248. padding-bottom: $grid-gutter-width;
  249. padding-left: 0;
  250. padding-right: 0;
  251. &:nth-child(4n+1) {
  252. clear: left;
  253. }
  254. }
  255. button {
  256. @include transition(all 0.2s ease);
  257. background-color: transparent;
  258. border: 0;
  259. color: darken($color-grey-3, 5%);
  260. height: auto;
  261. display: block;
  262. width: 100%;
  263. padding: 0 0 0.5em;
  264. overflow: visible;
  265. span {
  266. text-transform: none;
  267. white-space: pre-wrap;
  268. width: 100%;
  269. display: block;
  270. overflow: hidden;
  271. padding: 0 1em;
  272. box-sizing: border-box;
  273. }
  274. &:before {
  275. display: block;
  276. font-family: wagtail;
  277. font-size: 2em;
  278. width: 100%;
  279. height: 2em;
  280. line-height: 2em;
  281. text-align: center;
  282. }
  283. &:hover,
  284. &:focus {
  285. background-color: $color-teal;
  286. color: $color-white;
  287. }
  288. }
  289. &.stream-menu-closed {
  290. box-shadow: none;
  291. .stream-menu-inner ul {
  292. transform: scale(0.9);
  293. opacity: 0;
  294. }
  295. .toggle {
  296. color: $color-grey-3;
  297. background-color: $color-white;
  298. &:before {
  299. transform: rotate(0deg);
  300. }
  301. &:focus {
  302. color: $color-teal;
  303. }
  304. }
  305. &:hover {
  306. border-top-color: $color-teal;
  307. .toggle {
  308. color: $color-teal;
  309. }
  310. }
  311. }
  312. @include media-breakpoint-up(sm) {
  313. li {
  314. @include column(2);
  315. &:nth-child(4n+1) {
  316. clear: none;
  317. }
  318. &:nth-child(6n+1) {
  319. clear: left;
  320. }
  321. }
  322. }
  323. }
  324. .sequence-member .stream-menu {
  325. margin: auto auto 0;
  326. }
  327. .sequence-member .stream-menu-closed {
  328. opacity: 0;
  329. visibility: hidden;
  330. }
  331. .sequence-member:hover {
  332. .sequence-controls {
  333. visibility: visible;
  334. opacity: 1;
  335. }
  336. .stream-menu {
  337. visibility: visible;
  338. opacity: 1;
  339. }
  340. }