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