]> git.openstreetmap.org Git - rails.git/blob - app/assets/stylesheets/common.scss
Set sidebar background using Bootstrap class
[rails.git] / app / assets / stylesheets / common.scss
1 @import "parameters";
2 @import "bootstrap";
3 @import "rails_bootstrap_forms";
4
5 /* Styles common to large and small screens */
6
7 /* Default rules for the body of every page */
8
9 body {
10   font-size: $typeheight;
11 }
12
13 p > img {
14   width: auto;
15   max-width: 100%;
16 }
17
18 small, aside {
19   font-size: 12px;
20 }
21
22 time[title] {
23   text-decoration: underline dotted;
24 }
25
26 #container { position: relative; }
27
28 .small_icon {
29   vertical-align: middle;
30   margin-right: $lineheight * 0.25;
31 }
32
33 /* Rules for icons */
34
35 .icon {
36   display: inline-block;
37   vertical-align: top;
38   width: 20px;
39   height: 20px;
40   background: transparent image-url("sprite.svg") no-repeat 0 0;
41   text-indent: -9999px;
42   overflow: hidden;
43 }
44
45 .icon.search      { /*rtl:ignore*/ background-position: 0 0; }
46 .icon.donate      { /*rtl:ignore*/ background-position: -20px 0; }
47 .icon.zoomin      { /*rtl:ignore*/ background-position: -40px 0; }
48 .icon.zoomout     { /*rtl:ignore*/ background-position: -60px 0; }
49 .icon.geolocate   { /*rtl:ignore*/ background-position: -80px 0; }
50 .active .icon.geolocate   { /*rtl:ignore*/ background-position: -80px -20px; }
51 .icon.layers      { /*rtl:ignore*/ background-position: -100px 0; }
52 .icon.key         { /*rtl:ignore*/ background-position: -120px 0; }
53 .icon.share       { /*rtl:ignore*/ background-position: -140px 0; }
54 .icon.clipboard   { /*rtl:ignore*/ background-position: -160px 0; }
55 .icon.link        { /*rtl:ignore*/ background-position: -180px 0; }
56 .icon.close       { /*rtl:ignore*/ background-position: -200px 0; }
57 .icon.close:hover { /*rtl:ignore*/ background-position: -200px -20px; }
58 .icon.check       { /*rtl:ignore*/ background-position: -220px 0; }
59 .icon.note        { /*rtl:ignore*/ background-position: -240px 0; }
60 .icon.note.grey   { /*rtl:ignore*/ background-position: -240px -20px; }
61 .icon.query       { /*rtl:ignore*/ background-position: -260px 0; }
62
63 /* Utility for de-emphasizing content */
64
65 .text-muted a {
66   color: $blue;
67 }
68
69 /* Rules for borders */
70 /* These add additional colours to those provided by bootstrap */
71 .border-grey {
72   border-color: $grey !important;
73 }
74
75 /* Rules for the header */
76
77 #menu-icon {
78   display: none;
79   position: absolute;
80   top: 0;
81   right: 0;
82   background: image-url("menu-icon.png") no-repeat;
83   background-size: 30px 30px;
84   width: 30px;
85   height: 30px;
86   margin: 14px 10px 0 0;
87   opacity: 0.6;
88 }
89
90 header {
91   height: $headerHeight;
92   position: relative;
93   z-index: 1001;
94   font-size: 14px;
95
96   h1, nav, nav > ul, nav > ul > li {
97     display: inline-block;
98   }
99
100   > * {
101     height: 100%;
102     padding: $lineheight * 0.5;
103   }
104
105   img.logo {
106     margin-top: -2px;
107   }
108
109   h1 {
110     font-size: 18px;
111     line-height: 1.2;
112     padding-top: 15px;
113   }
114
115   .btn {
116     font-size: 14px;
117   }
118
119   nav.primary {
120     margin-right: auto;
121   }
122 }
123
124 nav.primary {
125   & > .btn-group .btn-outline-primary {
126     @include button-outline-variant($green, $color-hover: $white, $active-color: $white);
127   }
128
129   .disabled {
130     .btn-outline-primary {
131       color: $grey;
132       cursor: default;
133
134       .caret {
135         border-top-color: $grey;
136       }
137
138       &:hover {
139         background-color: lighten($green, 30%);
140       }
141     }
142   }
143
144   // Small tweaks to the toggle to stop the primary colour showing through
145   // when the menu is shown
146   .show > .btn-outline-primary.dropdown-toggle {
147     background-color: $green;
148     border-color: $green;
149
150     &:focus {
151       box-shadow: 0 0 0 0.2rem fade-out($green, 0.5);
152     }
153   }
154 }
155
156 nav.secondary {
157   .nav-link {
158     padding: 0.2rem;
159     color: $darkgrey;
160   }
161
162   > ul li.current a {
163     color: darken($darkgrey, 25%);
164   }
165
166   #inboxanchor {
167     background-color: lighten($grey, 10%);
168   }
169 }
170
171 nav.primary, nav.secondary {
172   .dropdown-item {
173     &:hover, &:active {
174       background-color: $green;
175       color: white;
176     }
177   }
178 }
179
180 #compact-secondary-nav {
181   display: none;
182 }
183
184 body.compact-nav {
185   #compact-secondary-nav {
186     display: inline-block;
187   }
188   .compact-hide {
189     display: none;
190   }
191 }
192
193 body.small-nav {
194   #menu-icon {
195     display: block;
196   }
197
198   header {
199     flex-direction: column;
200     height: auto;
201     min-height: $headerHeight;
202     background: #fff;
203
204     &.closed nav {
205       display: none;
206     }
207
208     .search_forms {
209       display: block;
210     }
211   }
212
213   #sidebar .search_forms,
214   #edit_tab,
215   #export_tab {
216     display: none;
217   }
218
219   nav.primary {
220     margin-right: 0;
221     padding: 0;
222
223     .btn-group {
224       width: 100%;
225       padding: 10px;
226     }
227   }
228
229   nav.secondary {
230     .user-menu, .login-menu {
231       width: 100%;
232     }
233   }
234
235   #compact-secondary-nav {
236     display: none;
237   }
238
239   .compact-hide {
240     display: inline-block;
241   }
242
243   .overlay-sidebar #sidebar .welcome {
244     display: none;
245   }
246
247   .overlay-sidebar #sidebar #banner {
248     display: none;
249   }
250 }
251
252 /* Utility for styling notification numbers */
253
254 .count-number {
255   background: lighten($green, 30%);
256   color: $gray-800;
257   font-weight: $font-weight-normal;
258 }
259
260 /* Rules for Leaflet maps */
261
262 .leaflet-top.leaflet-right,
263 .leaflet-top.leaflet-left {
264   height: 100%;
265   column-gap: 10px;
266   display: flex;
267   flex-direction: column;
268   flex-wrap: wrap-reverse;
269 }
270
271 .leaflet-control .control-button {
272   display: block;
273   height: 40px;
274   width: 40px;
275   background-color: #333;
276   background-color: rgba(0,0,0,.6);
277   outline: none;
278
279   &:hover,
280   &:focus {
281     background-color: black;
282   }
283
284   &.disabled,
285   &.leaflet-disabled {
286     background-color: #333;
287     background-color: rgba(0,0,0,.5);
288     cursor: default;
289   }
290
291   &.active {
292     background-color: $vibrant-green;
293   }
294
295   &-first {
296     border-start-start-radius: 4px;
297   }
298
299   &-last {
300     border-end-start-radius: 4px;
301     margin-bottom: 10px;
302   }
303
304   .icon {
305     margin: 10px;
306   }
307 }
308
309 /* Rules for the sidebar and main map area */
310
311 .map-layout {
312   #content {
313     overflow: hidden;
314     position: absolute;
315     top: $headerHeight;
316     bottom: 0;
317     width: 100%;
318   }
319
320   #sidebar, #map {
321     position: relative;
322     height: 100%;
323     overflow-x: hidden;
324     overflow-y: auto;
325   }
326
327   #sidebar {
328     float: left;
329     width: $sidebarWidth;
330
331     #sidebar_loader {
332       display: none;
333     }
334   }
335
336   .overlay-sidebar #sidebar {
337     position: absolute;
338     z-index: 1000;
339     height: auto;
340     overflow: hidden;
341
342     #banner {
343       display: block;
344     }
345
346     .welcome {
347       display: block;
348     }
349
350     #sidebar_content {
351       display: none;
352     }
353   }
354
355   .welcome {
356     display: none;
357   }
358
359   #banner {
360     display: none;
361
362     img {
363       display: block;
364       width: $sidebarWidth;
365     }
366   }
367
368   #map {
369     height: 100%;
370     overflow: hidden;
371
372     &.query-active {
373       cursor: help;
374     }
375
376     &.query-disabled {
377       cursor: not-allowed;
378     }
379
380     .leaflet-marker-draggable {
381       cursor: move;
382     }
383   }
384
385   #map-ui {
386     display: none;
387     position: relative;
388     float: right;
389     width: 250px;
390     height: 100%;
391     background: white;
392     overflow: auto;
393
394     .section {
395       border-bottom: 1px solid $grey;
396       padding: $spacer;
397     }
398   }
399 }
400
401 @include media-breakpoint-down(md) {
402   body.map-layout {
403     #sidebar, #map {
404       position: relative;
405       overflow-x: hidden;
406       width: 100%;
407       height: 50%;
408     }
409
410     #map-ui {
411       z-index: 9999;
412       width: 100%;
413       height: 50%;
414       overflow-y: scroll;
415     }
416
417     .overlay-sidebar {
418       #sidebar {
419         position: absolute;
420         width: 350px;
421         height: auto;
422         overflow: hidden;
423       }
424
425       #map, #map-ui {
426         height: 100%;
427       }
428     }
429   }
430 }
431
432 .layers-ui {
433   .base-layers {
434     .leaflet-container {
435       width: 100%;
436       height: 50px;
437       cursor: pointer;
438     }
439
440     li  {
441       overflow: hidden;
442       border-radius: 3px;
443       border: 2px solid #fff;
444       margin-bottom: 8px;
445       position: relative;
446       transition: border-color 0.08s ease-in;
447
448       label {
449         position: absolute;
450         top: 0;
451         left: 0;
452         padding: 2px 6px;
453         border-bottom-right-radius: 3px;
454         cursor: pointer;
455         font-weight: 600;
456         font-size: 16px;
457         text-stroke: 2px #fff;
458         background: rgba(255,255,255,.9);
459         z-index: 1000;
460         input[type="radio"] {
461           display: none;
462         }
463       }
464
465       &.active { border-color: darken($green, 10%); }
466       &:hover {
467         border-color: $grey;
468         &.active { border-color: darken($green, 20%); }
469       }
470     }
471   }
472
473   .overlay-layers {
474     p {
475       font-size: 13px;
476       margin-bottom: 8px;
477     }
478     li.disabled { color: $darkgrey; }
479   }
480 }
481
482 .share-ui {
483   #mapnik_scale {
484     width: 100px;
485   }
486 }
487
488 .leaflet-top {
489   top: 10px !important;
490   .leaflet-control {
491     margin-right: 0px !important;
492     margin-top: 0px !important;
493   }
494 }
495
496 .leaflet-popup-scrolled {
497   padding-right: $lineheight;
498   border-bottom: 0px !important;
499   border-top: 0px !important;
500 }
501
502 .leaflet-popup-content-wrapper {
503   border-radius: 4px !important;
504 }
505
506 /* Rules for attribution text under the main map shown on printouts */
507
508 .donate-attr { color: darken($green, 10%) !important; }
509
510 /* Rules for the sidebar */
511
512 #browse_status {
513   input {
514     display: block;
515     margin-left: auto;
516     margin-right: auto;
517   }
518 }
519
520 /* Temporary label size override until we remove site-wide font customisation */
521
522 form {
523   label {
524     font-size: 16px;
525   }
526   .col-form-label {
527     font-size: 16px;
528   }
529 }
530
531 /* Stop bootstrap 5 from floating legends when they don't need to be */
532 legend {
533   float: none;
534 }
535
536 /* Override the text colour for primary and secondary buttons, to match our
537    bootstrap 4 colours. Note this has accessibility issues, which is why
538    bootstrap 5 calculates black as the appropriate colour, and we should
539    reconsider our colours at some point with that in mind. */
540
541 .btn-primary {
542   @include button-variant($primary, $primary, $color: $white, $hover-color: $white, $active-color: $white, $disabled-color: $white);
543 }
544
545 .btn-secondary {
546   @include button-variant($secondary, $secondary, $color: $white, $hover-color: $white, $active-color: $white, $disabled-color: $white);
547 }
548
549 .btn-outline-secondary {
550   @include button-outline-variant($secondary, $color-hover: $white, $active-color: $white);
551 }
552
553 /* Rules for the search and direction forms */
554
555 header .search_forms,
556 .directions_form {
557   display: none;
558 }
559
560 /* Rules for search sidebar */
561
562 #sidebar .search_results_entry {
563   ul li.selected {
564     background: $list-highlight;
565   }
566
567   .search_more .loader {
568     display: none;
569   }
570 }
571
572 /* Rules for routing */
573
574 div.direction {
575   background-image: image-url('routing-sprite.png');
576   width: 20px;
577   height: 20px;
578   background-repeat: no-repeat;
579 }
580 @for $i from 0 through 25 {
581 div.direction.i#{$i} { background-position: #{($i)*-20}px 0px; }
582 }
583
584 td.distance {
585     font-size: x-small;
586 }
587 tr.turn {
588     cursor: pointer;
589 }
590 tr.turn:hover {
591     background: $list-highlight;
592 }
593
594 .routing_marker { width: 15px; cursor: move; }
595
596 .browse_status {
597   display: none;
598 }
599
600 /* Rules for the history sidebar */
601
602 #sidebar .changesets {
603   li {
604     &.selected { background: $list-highlight; }
605     /* color is derived from changeset bbox fillColor in history.js */
606
607     a.stretched-link > span, a:not(.stretched-link), [title] {
608       position: relative;
609       z-index: 2; /* needs to be higher than Bootstrap's stretched link ::after z-index */
610     }
611   }
612
613   .changeset_more .loader {
614     display: none;
615     width: 100%;
616   }
617 }
618
619 /* Rules for the browse sidebar */
620
621 #sidebar_content {
622   .browse-section {
623     padding-bottom: $spacer;
624     margin-bottom: $spacer;
625     border-bottom: 1px solid $grey;
626
627     h4:first-child {
628       word-wrap: break-word;
629     }
630   }
631
632   .browse-section:last-of-type {
633     border-bottom: none;
634   }
635
636   .browse-tag-list {
637     table-layout: fixed;
638     white-space: pre-wrap;
639
640     tr:last-child th, tr:last-child td {
641       border-bottom: 0;
642     }
643   }
644
645   .note-description {
646     overflow: hidden;
647     margin: 0 0 10px 10px;
648   }
649
650   .query-results {
651     display: none;
652
653     ul {
654       li {
655         &.query-result {
656           cursor: pointer;
657         }
658
659         &.selected {
660           background: $list-highlight;
661         }
662       }
663     }
664   }
665 }
666
667 /* Bootstrap buttons don't have any vertical margin, so
668    they touch when adjacent buttons wrap onto a new line
669    e.g. wide form buttons on a narrow sidebar */
670
671 .btn-wrapper {
672   > .btn {
673     margin-bottom: $spacer * 0.25;
674   }
675 }
676
677 /* Force LTR/RTL alignment for placeholder text */
678
679 .form-control::placeholder {
680   text-align: left;
681 }
682
683 /* Rules for export sidebar */
684
685 .export_form {
686   .export_area_inputs,
687   .export_button {
688     text-align: center;
689   }
690
691   .export_area_inputs {
692     margin-bottom: $spacer;
693     input[type="text"] {
694       width: 100px;
695       text-align: center;
696     }
697   }
698
699   .export_boxy {
700     background: $lightgrey;
701
702     #maxlat { margin-top: -1px; }
703     #minlon {
704       float: left;
705       /*rtl:ignore*/ margin-left: -1px;
706     }
707     #maxlon {
708       float: right;
709       /*rtl:ignore*/ margin-right: -1px;
710     }
711     #minlat { margin-bottom: -1px; }
712   }
713 }
714
715 /* Rules for edit pages */
716
717 .site-edit {
718   #content {
719     position: absolute;
720     top: $headerHeight;
721     bottom: 0;
722     width: 100%;
723   }
724 }
725
726 /* Rules for non-map content pages */
727
728 .content-heading {
729   background: $lightgrey;
730 }
731
732 .content-inner {
733   position: relative;
734   max-width: 960px;
735   margin: auto;
736   padding: $lineheight;
737 }
738
739 /* Overrides for pages that use new layout conventions */
740
741 .header-illustration {
742   background-position: 0 0;
743   background-repeat: no-repeat;
744   position: relative;
745   min-height: 200px;
746   width: 100%;
747   left: 0;
748   bottom: 0;
749
750   &.new-user-main {
751     background-image: image-url("sign-up-illustration.png");
752   }
753
754   &.confirm-main {
755     background-image: image-url("confirm-illustration.png");
756   }
757
758   &.new-user-terms {
759     background-image: image-url("terms-illustration.png");
760   }
761
762   &.new-user-arm {
763     height: 110px;
764     width: 130px;
765     left: 280px;
766     top: 180px;
767     background-image: image-url("sign-up-illustration-arm.png");
768     position: absolute;
769     z-index: 100;
770     pointer-events: none;
771   }
772 }
773
774 [dir=rtl] .header-illustration {
775   transform: scaleX(-1);
776
777   h1 {
778     transform: scaleX(-1);
779   }
780 }
781
782 /* Rules for small maps in content areas */
783
784 .content_map {
785   height: 200px;
786   margin-bottom: $lineheight;
787 }
788
789 @include media-breakpoint-up(md) {
790   .content_map {
791     height: 400px;
792   }
793 }
794
795 /* Rules for the user map */
796
797 .content_map .leaflet-popup-content {
798   margin: $spacer;
799   min-height: 50px;
800 }
801
802 /* Rules for user popups on maps */
803
804 .user_popup {
805   min-width: 200px;
806   p {
807     padding: 0 0 5px 0;
808     margin: 0 0 0 60px;
809     font-size: 12px;
810   }
811 }
812
813 /* Rules for the diary entry page */
814
815 .diary_entries {
816   #map {
817     height: 400px;
818     display: none;
819   }
820   .diary-comment .col-auto {
821     width: 62px;
822   }
823   .diary-comment .col {
824     max-width: 690px;
825   }
826 }
827
828 /* Rules for the account confirmation page */
829
830 .users-terms {
831   .legale {
832     padding: $lineheight;
833     margin-bottom: $lineheight;
834     overflow: auto;
835     height: 20em;
836
837     li {
838       list-style: inherit;
839     }
840
841     ol ol {
842       list-style-type: lower-alpha;
843     }
844   }
845 }
846
847 /* Rules for messages pages */
848
849 .messages {
850   .inbox-row {
851     background: $offwhite;
852   }
853
854   .inbox-row-unread td {
855     background: #CBEEA7;
856   }
857 }
858
859 .search_form {
860   background-color: $lightgrey;
861
862   #query {
863     z-index: 0;
864   }
865
866   .describe_location {
867     font-size: 10px;
868   }
869 }
870
871 .directions_form {
872   background-color: $lightgrey;
873 }
874
875 /* Rules for user images */
876
877 img.user_image {
878   max-width: 100px;
879   max-height: 100px;
880 }
881
882 img.user_thumbnail {
883   max-width: 50px;
884   max-height: 50px;
885 }
886
887 img.user_thumbnail_tiny {
888   width: 25px;
889   height: 25px;
890   object-fit: contain;
891 }
892
893 /* General styles for action lists / subnavs */
894
895 nav.secondary-actions {
896   margin-left: -11px;
897   overflow: hidden;
898   > ul {
899     display: flex;
900     flex-direction: row;
901     flex-wrap: wrap;
902     margin-bottom: 0;
903     margin-left: -1px;
904     padding: 0;
905     > li {
906       flex-basis: auto;
907       list-style: none;
908       border-left: 1px solid $grey;
909       padding-left: $lineheight * 0.5;
910       margin-right: $lineheight * 0.5;
911       margin-bottom: $lineheight * 0.125;
912     }
913   }
914 }
915
916 div.secondary-actions {
917   padding: 10px;
918   text-align: center;
919 }
920
921 /* Rules for rich text */
922
923 .richtext,
924 .prose {
925   code {
926     background: $lightgrey;
927     padding: 2px 3px;
928   }
929
930   pre {
931     background: $lightgrey;
932     padding: 2px 3px;
933     white-space: pre-wrap;
934
935     code {
936       padding: 0;
937     }
938   }
939
940   img {
941     padding: $lineheight;
942     background-color: $offwhite;
943     display: block;
944     max-width: 100%;
945     margin: auto;
946   }
947
948   blockquote {
949     border-left: $lineheight solid $offwhite;
950     padding-left: $lineheight;
951     margin: 0;
952     color: $darkgrey;
953   }
954 }
955
956 /* Rules for the "Welcome" page */
957 .site-welcome, .site-fixthemap {
958   .sprite {
959     background-image: image-url("welcome-sprite.png");
960     background-size: 500px 250px;
961     display: block;
962   }
963
964   .sprite.small {
965     width: 50px;
966     height: 50px;
967   }
968
969   .sprite.x {
970     /*rtl:ignore*/ background-position: -50px 0;
971   }
972
973   .sprite.term {
974     margin-right: 10px;
975     vertical-align: middle;
976   }
977
978   .sprite.node {
979     /*rtl:ignore*/ background-position: -100px 0;
980   }
981
982   .sprite.way {
983     /*rtl:ignore*/ background-position: -150px 0;
984   }
985
986   .sprite.tag {
987     /*rtl:ignore*/ background-position: -200px 0;
988   }
989
990   .sprite.editor {
991     /*rtl:ignore*/ background-position: -250px 0;
992   }
993
994   .sprite.question {
995     /*rtl:ignore*/ background-position: -300px 0;
996   }
997
998   .sprite.rules {
999     /*rtl:ignore*/ background-position: -350px 0;
1000   }
1001
1002   .icon.note {
1003     background-color: #333;
1004     border-radius: 4px;
1005   }
1006 }
1007
1008 .site-about #content {
1009   background-color: $lightgrey;
1010
1011   .content-inner {
1012     max-width: 760px;
1013   }
1014
1015   .attr {
1016     margin-top: -20px;
1017
1018     h1 {
1019       span {
1020         color: $vibrant-green;
1021       }
1022     }
1023
1024     .user-image {
1025       height: 150px;
1026       background-position: 0 50%;
1027       background-repeat: no-repeat;
1028       background-image: image-url('about/osm.png');
1029       background-size: cover;
1030       background-color: $vibrant-green;
1031     }
1032
1033     .byosm {
1034       background: $vibrant-green;
1035     }
1036
1037     .byosm span {
1038       display: inline-block;
1039       width: 1em;
1040       margin-left: -1em;
1041     }
1042   }
1043
1044   .icon {
1045     width: 30px;
1046     height: 30px;
1047     background: 40px 40px image-url('about/sprite.png') no-repeat;
1048
1049     &.local {
1050       /*rtl:ignore*/
1051       background-position: 0px 0px;
1052     }
1053     &.community {
1054       /*rtl:ignore*/
1055       background-position: 0px -40px;
1056     }
1057     &.open {
1058       /*rtl:ignore*/
1059       background-position: 0px -80px;
1060     }
1061     &.partners {
1062       /*rtl:ignore*/
1063       background-position: 0px -120px;
1064     }
1065     &.infringement {
1066       /*rtl:ignore*/
1067       background-position: 0px -160px;
1068     }
1069     &.legal {
1070       /*rtl:ignore*/
1071       background-position: -45px -160px;
1072     }
1073   }
1074 }
1075
1076 @import 'browse';