]> BookStack Code Mirror - bookstack/blob - resources/sass/_lists.scss
Made chapter toggle in book sidebar nav more consistent
[bookstack] / resources / sass / _lists.scss
1
2 .book-contents .entity-list-item {
3   .icon {
4     width: 4px;
5     border-radius: 1px;
6     justify-self: stretch;
7     align-self: stretch;
8     height: auto;
9     margin-inline-end: $-xs;
10   }
11   .icon:after {
12     opacity: 0.5;
13   }
14   .icon svg {
15     display: none;
16   }
17   p {
18     margin-bottom: 0;
19   }
20   .inner-page {
21     padding-top: 0;
22     padding-bottom: 0;
23   }
24 }
25
26 .entity-list-item + .chapter-expansion {
27   display: flex;
28   padding: 0 $-m $-m $-m;
29   align-items: center;
30   border: 0;
31   width: 100%;
32   position: relative;
33   > .icon {
34     width: 4px;
35     height: auto;
36     border-radius: 0 0 1px 1px;
37     align-self: stretch;
38     flex-shrink: 0;
39     &:before {
40       position: absolute;
41       top: 0;
42       left: 0;
43       width: 100%;
44       height: 1px;
45       background-color: currentColor;
46       content: '';
47       opacity: 0.5;
48     }
49     &:after {
50       opacity: 0.5;
51     }
52   }
53   .icon svg {
54     display: none;
55   }
56   > .content {
57     flex: 1;
58   }
59   .chapter-contents-toggle {
60     border-radius: 0 4px 4px 0;
61     padding: $-xs ($-m + $-xxs);
62     width: 100%;
63     text-align: start;
64   }
65   .chapter-contents-toggle:hover {
66     background-color: rgba(0, 0, 0, 0.06);
67   }
68 }
69
70 .entity-list-item.has-children {
71   padding-bottom: 0;
72   > .icon {
73     border-radius: 4px 4px 0 0;
74   }
75 }
76
77 .inset-list {
78   display: none;
79   .entity-list-item-name {
80     font-size: 1rem;
81   }
82   .entity-list-item-children {
83     padding-top: 0;
84     padding-bottom: 0;
85   }
86 }
87
88 .sidebar-page-nav {
89   $nav-indent: $-m;
90   list-style: none;
91   @include margin($-s, 0, $-m, $-xs);
92   position: relative;
93   &:after {
94     content: '';
95     display: block;
96     position: absolute;
97     left: 0;
98     @include rtl {
99       left: auto;
100       right: 0;
101     }
102     @include lightDark(background-color, rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.2));
103     width: 2px;
104     top: 5px;
105     bottom: 5px;
106     z-index: 0;
107   }
108   li {
109     margin-bottom: 4px;
110     font-size: 0.95em;
111     position: relative;
112   }
113   .h1 {
114     padding-inline-start: $nav-indent;
115   }
116   .h2 {
117     padding-inline-start: $nav-indent * 1.5;
118   }
119   .h3 {
120     padding-inline-start: $nav-indent * 2;
121   }
122   .h4 {
123     padding-inline-start: $nav-indent * 2.5;
124   }
125   .h5 {
126     padding-inline-start: $nav-indent*3;
127   }
128   .h6 {
129     padding-inline-start: $nav-indent*3.5;
130   }
131   .current-heading {
132     font-weight: bold;
133   }
134   li:not(.current-heading) .sidebar-page-nav-bullet {
135     @include lightDark(background-color, #BBB, #666, true);
136   }
137   .sidebar-page-nav-bullet {
138     width: 6px;
139     height: 6px;
140     position: absolute;
141     left: -2px;
142     top: 30%;
143     border-radius: 50%;
144     box-shadow: 0 0 0 6px #F2F2F2;
145     @include lightDark(box-shadow, 0 0 0 6px #F2F2F2, 0 0 0 6px #111);
146     z-index: 1;
147     @include rtl {
148       left: auto;
149       right: -2px;
150     }
151   }
152 }
153
154 // Sidebar list
155 .book-tree .sidebar-page-list  {
156   list-style: none;
157   @include margin($-xs, -$-s, 0, -$-s);
158   padding-inline-start: 0;
159   padding-inline-end: 0;
160
161   ul {
162     list-style: none;
163     padding-inline-start: 1rem;
164     padding-inline-end: 0;
165   }
166
167   .entity-list-item {
168     padding-top: 2px;
169     padding-bottom: 2px;
170     background-clip: content-box;
171     border-radius: 0 3px 3px 0;
172     padding-inline-end: 0;
173     .content {
174       width: 100%;
175       padding-top: $-xs;
176       padding-bottom: $-xs;
177       max-width: calc(100% - 20px);
178     }
179   }
180   .entity-list-item.selected {
181     @include lightDark(background-color, rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.06));
182   }
183   .entity-list-item.no-hover {
184     margin-top: -$-xs;
185     padding-inline-end: 0;
186   }
187   .entity-list-item-name {
188     font-size: 1em;
189     margin: 0;
190     margin-inline-end: $-m;
191   }
192   .chapter-child-menu {
193     font-size: .8rem;
194     margin-top: -.2rem;
195     margin-inline-start: -1rem;
196   }
197   .chapter-contents-toggle {
198     display: block;
199     width: 100%;
200     text-align: left;
201     padding: $-xxs $-s ($-xxs * 2) $-s;
202     border-radius: 0 3px 3px 0;
203     line-height: 1;
204     margin-top: -$-xxs;
205     margin-bottom: -$-xxs;
206     &:hover {
207       @include lightDark(background-color, rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.06));
208     }
209   }
210   .entity-list-item .icon {
211     z-index: 2;
212     width: 4px;
213     height: auto;
214     align-self: stretch;
215     flex-shrink: 0;
216     border-radius: 1px;
217     opacity: 0.8;
218   }
219   .entity-list-item .icon:after {
220     opacity: 1;
221   }
222   .entity-list-item .icon svg {
223     display: none;
224   }
225 }
226
227 .chapter-child-menu ul.sub-menu {
228   display: none;
229   padding-inline-start: 0;
230   position: relative;
231   margin-bottom: 0;
232 }
233
234 // Sortable Lists
235 .sortable-page-list, .sortable-page-list ul {
236   list-style: none;
237 }
238 .sort-box {
239   margin-bottom: $-m;
240   padding: $-m $-xl;
241   position: relative;
242   &::before {
243     pointer-events: none;
244     content: '';
245     border-radius: 4px;
246     opacity: 0.5;
247     border: 2px solid var(--color-book);
248     display: block;
249     top: 0;
250     bottom: 0;
251     left: 0;
252     right: 0;
253     position: absolute;
254   }
255 }
256 .sort-box-options {
257   display: flex;
258   flex-wrap: wrap;
259   justify-content: space-between;
260 }
261 .sort-box-options .button {
262   margin-inline-start: 0;
263 }
264 .sortable-page-list {
265   margin-inline-start: 0;
266   padding: 0;
267   .entity-list-item > span:first-child {
268     align-self: flex-start;
269   }
270   .sortable-selected  .entity-list-item, .sortable-selected  .entity-list-item:hover {
271     outline: 1px dotted var(--color-primary);
272     background-color: var(--color-primary-light) !important;
273   }
274   .entity-list-item > div {
275     display: block;
276     flex: 1;
277   }
278   > ul {
279     margin-inline-start: 0;
280   }
281   ul {
282     margin-bottom: $-m;
283     margin-top: 0;
284     padding-inline-start: $-m;
285   }
286   li {
287     border: 1px solid #DDD;
288     margin-top: -1px;
289     min-height: 38px;
290   }
291   li.text-page, li.text-chapter {
292     border-inline-start: 2px solid currentColor;
293   }
294   li:first-child {
295     margin-top: $-xs;
296   }
297 }
298 .sortable-page-list li.placeholder {
299   position: relative;
300 }
301 .sortable-page-list li.placeholder:before {
302   position: absolute;
303 }
304
305 .activity-list-item {
306   padding: $-s 0;
307   display: grid;
308   grid-template-columns: min-content 1fr;
309   grid-column-gap: $-m;
310   font-size: 0.9em;
311 }
312 .card .activity-list-item {
313   padding: $-s $-m;
314 }
315
316 .user-list-item {
317   display: inline-grid;
318   padding: $-s;
319   grid-template-columns: min-content 1fr;
320   grid-column-gap: $-m;
321   font-size: 0.9em;
322   align-items: center;
323   > div:first-child {
324     line-height: 0;
325   }
326 }
327
328 ul.pagination {
329   display: inline-block;
330   list-style: none;
331   margin: $-m 0;
332   padding-inline-start: 1px;
333   li {
334     float: left;
335   }
336   li:first-child {
337     a, span {
338       border-radius: 3px 0 0 3px;
339     }
340   }
341   li:last-child {
342     a, span {
343       border-radius: 0 3px 3px 0;
344     }
345   }
346   a, span {
347     display: block;
348     padding: $-xxs $-s;
349     border: 1px solid #CCC;
350     margin-inline-start: -1px;
351     user-select: none;
352     @include lightDark(color, #555, #eee);
353     @include lightDark(border-color, #ccc, #666);
354   }
355   li.disabled {
356     cursor: not-allowed;
357   }
358   li.active span {
359     @include lightDark(color, #111, #eee);
360     @include lightDark(background-color, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.5));
361   }
362 }
363
364 .compact ul.pagination {
365   margin: 0;
366 }
367
368 .entity-list, .icon-list {
369   margin: 0 (-$-m);
370   h4 {
371     margin: 0;
372   }
373   hr {
374     margin: 0;
375   }
376   .text-small.text-muted {
377     color: #AAA;
378     font-size: 0.75em;
379     margin-top: $-xs;
380   }
381   .text-muted p.text-muted {
382     margin-top: 0;
383   }
384   .page.draft .text-page {
385     color: var(--color-page-draft);
386     fill: var(--color-page-draft);
387   }
388   > .dropdown-container {
389     display: block;
390   }
391 }
392
393 .icon-list hr {
394   margin: $-s $-m;
395   max-width: 140px;
396   opacity: 0.25;
397   height: 1.1px;
398 }
399
400 .icon-list hr + hr, .icon-list hr:first-child, .icon-list hr:last-child {
401   display: none;
402 }
403
404 .entity-list-item, .icon-list-item {
405   padding: $-s $-m;
406   display: flex;
407   align-items: center;
408   gap: $-m;
409   background-color: transparent;
410   border: 0;
411   width: 100%;
412   position: relative;
413   word-break: break-word;
414   h4 a {
415     color: #666;
416   }
417   > span:first-child {
418     flex-basis: 1.88em;
419     flex: none;
420   }
421   > span:last-child {
422     flex: 1;
423     text-align: start;
424   }
425   > .content {
426     min-width: 0;
427   }
428   &:not(.no-hover) {
429     cursor: pointer;
430   }
431   &:not(.no-hover):hover {
432     @include lightDark(background-color, rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.06));
433     text-decoration: none;
434     border-radius: 4px;
435   }
436   &.outline-hover:hover {
437     background-color: transparent;
438   }
439   &:focus {
440     @include lightDark(background-color, #eee, #222);
441     outline: 1px dotted #666;
442     outline-offset: -2px;
443   }
444 }
445
446 .entity-list-item-path-sep {
447   display: inline-block;
448   vertical-align: top;
449   position: relative;
450   top: 1px;
451   svg {
452     margin-inline-end: 0;
453   }
454 }
455
456 .card .entity-list-item:not(.no-hover, .book-contents .entity-list-item):hover {
457   @include lightDark(background-color, #F2F2F2, #2d2d2d);
458   border-radius: 0;
459 }
460 .card .entity-list-item .entity-list-item:hover {
461   background-color: #EEEEEE;
462 }
463
464 .entity-list-item-children {
465   padding: $-m $-l;
466   > div {
467     overflow: hidden;
468     padding: 0 0 $-xs 0;
469   }
470   .entity-chip {
471     text-overflow: ellipsis;
472     height: 2.5em;
473     overflow: hidden;
474     text-align: start;
475     display: block;
476     white-space: nowrap;
477   }
478   > .entity-list > .entity-list-item:last-child {
479     margin-bottom: -$-xs;
480   }
481 }
482
483 .entity-list-item-image {
484   align-self: stretch;
485   width: 140px;
486   flex: none;
487   background-size: cover;
488   background-position: 50% 50%;
489   border-radius: 3px;
490   position: relative;
491   margin-inline-end: $-l;
492
493   &.entity-list-item-image-wide {
494     width: 220px;
495   }
496
497   .svg-icon {
498     @include lightDark(color, #fff, rgba(255, 255, 255, 0.6));
499     font-size: 1.66rem;
500     margin-inline-end: 0;
501     position: absolute;
502     bottom: $-xs;
503     left: $-xs;
504   }
505
506   @include smaller-than($m) {
507     width: 80px;
508   }
509 }
510
511 .chapter > .entity-list-item-image {
512   width: 60px;
513 }
514
515 .entity-list.compact {
516   font-size: 0.6 * $fs-m;
517   h4, a {
518     line-height: 1.2;
519   }
520   .entity-item-snippet {
521     display: none;
522   }
523   .entity-list-item p {
524     font-size: $fs-m * 0.8;
525     padding-top: $-xs;
526   }
527   .entity-list-item p:empty {
528     padding-top: 0;
529   }
530   p {
531     margin: 0;
532   }
533   > p.empty-text {
534     display: block;
535     font-size: $fs-m;
536   }
537   hr {
538     margin: 0;
539   }
540   @include smaller-than($m) {
541     h4 {
542       font-size: 1.666em;
543     }
544   }
545 }
546
547 .entity-item-tags {
548   font-size: .75rem;
549   opacity: 1;
550   .primary-background-light {
551     background: transparent;
552   }
553   .tag-name {
554     background-color: rgba(0, 0, 0, 0.05);
555   }
556 }
557
558 .dropdown-container {
559   display: inline-block;
560   vertical-align: top;
561   position: relative;
562 }
563
564 .dropdown-menu {
565   display: none;
566   position: absolute;
567   z-index: 999;
568   top: 0;
569   list-style: none;
570   right: 0;
571   margin: $-m 0;
572   @include lightDark(background-color, #fff, #333);
573   box-shadow: 0 1px 6px 0 rgba(0, 0, 0, 0.18);
574   border-radius: 3px;
575   min-width: 180px;
576   padding: $-xs 0;
577   @include lightDark(color, #555, #eee);
578   fill: currentColor;
579   text-align: start !important;
580   max-height: 500px;
581   overflow-y: auto;
582   &.wide {
583     min-width: 220px;
584   }
585   .text-muted {
586     color: #999;
587     fill: #999;
588   }
589   li.active a {
590     font-weight: 600;
591   }
592   button {
593     width: 100%;
594     text-align: start;
595   }
596   li.border-bottom {
597     border-bottom: 1px solid #DDD;
598   }
599   li hr {
600     margin: $-xs 0;
601   }
602   .icon-item, .text-item, .label-item {
603     padding: 8px $-m;
604     @include lightDark(color, #555, #eee);
605     fill: currentColor;
606     white-space: nowrap;
607     line-height: 1.4;
608     cursor: pointer;
609     &:hover, &:focus {
610       text-decoration: none;
611       background-color: var(--color-primary-light);
612       color: var(--color-primary);
613     }
614     &:focus {
615       outline: 1px solid var(--color-primary);
616       outline-offset: -2px;
617     }
618     svg {
619       margin-inline-end: $-s;
620       display: inline-block;
621       width: 16px;
622     }
623   }
624   .text-item {
625     display: block;
626   }
627   .label-item {
628     display: grid;
629     align-items: center;
630     grid-template-columns: auto min-content;
631     gap: $-m;
632   }
633   .label-item > *:nth-child(2) {
634     opacity: 0.7;
635     &:hover {
636       opacity: 1;
637     }
638   }
639   .icon-item {
640     display: grid;
641     align-items: start;
642     grid-template-columns: 16px auto;
643     gap: $-m;
644     svg {
645       margin-inline-end: 0;
646       margin-block-start: 1px;
647     }
648   }
649 }
650
651 // Shift in right-sidebar dropdown menus to prevent shadows
652 // being cut by scrollable container.
653 .tri-layout-right .dropdown-menu {
654   right: $-xs;
655 }
656
657 // Books grid view
658 .featured-image-container {
659   position: relative;
660   overflow: hidden;
661   min-height: 140px;
662   background-size: cover;
663   background-position: 50% 50%;
664   transition: opacity ease-in-out 240ms;
665   a {
666     display: block;
667   }
668   img {
669     display: block;
670     width: 100%;
671     max-width: 100%;
672     height: auto;
673   }
674 }
675 .featured-image-container-wrap {
676   position: relative;
677   .svg-icon {
678     @include lightDark(color, #fff, rgba(255, 255, 255, 0.6));
679     font-size: 2rem;
680     margin-inline-end: 0;
681     position: absolute;
682     bottom: 10px;
683     left: 6px;
684   }
685 }
686 .grid-card:hover .featured-image-container {
687   opacity: .5;
688 }
689
690 .action-link-list {
691   //padding: $-s 0;
692 }
693 .action-link {
694   background: transparent;
695   border: none;
696   color: currentColor;
697   padding: $-m 0;
698 }
699
700 .active-link-list {
701   a {
702     display: inline-block;
703     padding: $-s;
704   }
705   a:not(.active) {
706     @include lightDark(color, #444, #888);
707   }
708   a:hover {
709     @include lightDark(background-color, rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.05));
710     border-radius: 4px;
711     text-decoration: none;
712   }
713   &.in-sidebar {
714     a {
715       display: block;
716       margin-bottom: $-xs;
717     }
718     a.active {
719       border-radius: 4px;
720       @include lightDark(background-color, rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.05));
721     }
722   }
723 }
724
725 .entity-meta-item {
726   display: flex;
727   line-height: 1.2;
728   margin: 0.6em 0;
729   align-content: start;
730   gap: $-s;
731   a {
732     line-height: 1.2;
733   }
734   svg {
735     flex-shrink: 0;
736     width: 1em;
737     margin: 0;
738   }
739 }