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