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