]> git.openstreetmap.org Git - rails.git/blob - app/assets/stylesheets/common.scss
Merge remote-tracking branch 'upstream/pull/4662'
[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     background: white;
381     overflow: auto;
382
383     .section {
384       border-bottom: 1px solid $grey;
385       padding: $spacer;
386     }
387   }
388 }
389
390 @include media-breakpoint-down(md) {
391   body.map-layout {
392     #sidebar, #map {
393       position: relative;
394       overflow-x: hidden;
395       width: 100%;
396       height: 50%;
397     }
398
399     #map-ui {
400       z-index: 9999;
401       width: 100%;
402       height: 50%;
403       overflow-y: scroll;
404     }
405
406     .overlay-sidebar {
407       #sidebar {
408         position: absolute;
409         width: 350px;
410         height: auto;
411         overflow: hidden;
412       }
413
414       #map, #map-ui {
415         height: 100%;
416       }
417     }
418   }
419 }
420
421 .layers-ui {
422   .base-layers {
423     .leaflet-container {
424       width: 100%;
425       height: 50px;
426       cursor: pointer;
427     }
428
429     li  {
430       overflow: hidden;
431       border-radius: 3px;
432       border: 2px solid #fff;
433       margin-bottom: 8px;
434       position: relative;
435       transition: border-color 0.08s ease-in;
436
437       label {
438         position: absolute;
439         top: 0;
440         left: 0;
441         padding: 2px 6px;
442         border-bottom-right-radius: 3px;
443         cursor: pointer;
444         font-weight: 600;
445         font-size: 16px;
446         text-stroke: 2px #fff;
447         background: rgba(255,255,255,.9);
448         z-index: 1000;
449         input[type="radio"] {
450           display: none;
451         }
452       }
453
454       &.active { border-color: darken($green, 10%); }
455       &:hover {
456         border-color: $grey;
457         &.active { border-color: darken($green, 20%); }
458       }
459     }
460   }
461
462   .overlay-layers {
463     p {
464       font-size: 13px;
465       margin-bottom: 8px;
466     }
467     li.disabled { color: $darkgrey; }
468   }
469 }
470
471 .share-ui {
472   #mapnik_scale {
473     width: 100px;
474   }
475 }
476
477 .leaflet-top {
478   top: 10px !important;
479   .leaflet-control {
480     margin-right: 0px !important;
481     margin-top: 0px !important;
482   }
483 }
484
485 .leaflet-popup-scrolled {
486   padding-right: $lineheight;
487   border-bottom: 0px !important;
488   border-top: 0px !important;
489 }
490
491 .leaflet-popup-content-wrapper {
492   border-radius: 4px !important;
493 }
494
495 /* Rules for attribution text under the main map shown on printouts */
496
497 .donate-attr { color: darken($green, 10%) !important; }
498
499 /* Rules for the sidebar */
500
501 #browse_status {
502   input {
503     display: block;
504     margin-left: auto;
505     margin-right: auto;
506   }
507 }
508
509 /* Temporary label size override until we remove site-wide font customisation */
510
511 form {
512   label {
513     font-size: 16px;
514   }
515   .col-form-label {
516     font-size: 16px;
517   }
518 }
519
520 /* Stop bootstrap 5 from floating legends when they don't need to be */
521 legend {
522   float: none;
523 }
524
525 /* Override the text colour for primary and secondary buttons, to match our
526    bootstrap 4 colours. Note this has accessibility issues, which is why
527    bootstrap 5 calculates black as the appropriate colour, and we should
528    reconsider our colours at some point with that in mind. */
529
530 .btn-primary {
531   @include button-variant($primary, $primary, $color: $white, $hover-color: $white, $active-color: $white, $disabled-color: $white);
532 }
533
534 .btn-secondary {
535   @include button-variant($secondary, $secondary, $color: $white, $hover-color: $white, $active-color: $white, $disabled-color: $white);
536 }
537
538 .btn-outline-secondary {
539   @include button-outline-variant($secondary, $color-hover: $white, $active-color: $white);
540 }
541
542 /* Rules for the search and direction forms */
543
544 header .search_forms,
545 .directions_form {
546   display: none;
547 }
548
549 /* Rules for search sidebar */
550
551 #sidebar .search_results_entry {
552   ul li.selected {
553     background: $list-highlight;
554   }
555
556   .search_more .loader {
557     display: none;
558   }
559 }
560
561 /* Rules for routing */
562
563 div.direction {
564   background-image: image-url('routing-sprite.png');
565   width: 20px;
566   height: 20px;
567   background-repeat: no-repeat;
568 }
569 @for $i from 0 through 25 {
570 div.direction.i#{$i} { background-position: #{($i)*-20}px 0px; }
571 }
572
573 td.distance {
574     font-size: x-small;
575 }
576 tr.turn {
577     cursor: pointer;
578 }
579 tr.turn:hover {
580     background: $list-highlight;
581 }
582
583 .routing_marker { width: 15px; cursor: move; }
584
585 .browse_status {
586   display: none;
587 }
588
589 /* Rules for the history sidebar */
590
591 #sidebar .changesets {
592   li {
593     &.selected { background: $list-highlight; }
594     /* color is derived from changeset bbox fillColor in history.js */
595
596     a.stretched-link > span, a:not(.stretched-link), [title] {
597       position: relative;
598       z-index: 2; /* needs to be higher than Bootstrap's stretched link ::after z-index */
599     }
600   }
601
602   .changeset_more .loader {
603     display: none;
604     width: 100%;
605   }
606 }
607
608 /* Rules for the browse sidebar */
609
610 #sidebar_content {
611   .browse-section {
612     padding-bottom: $spacer;
613     margin-bottom: $spacer;
614     border-bottom: 1px solid $grey;
615
616     h4:first-child {
617       word-wrap: break-word;
618     }
619   }
620
621   .browse-section:last-of-type {
622     border-bottom: none;
623   }
624
625   .browse-tag-list {
626     table-layout: fixed;
627     white-space: pre-wrap;
628
629     tr:last-child th, tr:last-child td {
630       border-bottom: 0;
631     }
632   }
633
634   .note-description {
635     overflow: hidden;
636     margin: 0 0 10px 10px;
637   }
638
639   .query-results {
640     display: none;
641
642     ul {
643       li {
644         &.query-result {
645           cursor: pointer;
646         }
647
648         &.selected {
649           background: $list-highlight;
650         }
651       }
652     }
653   }
654 }
655
656 /* Bootstrap buttons don't have any vertical margin, so
657    they touch when adjacent buttons wrap onto a new line
658    e.g. wide form buttons on a narrow sidebar */
659
660 .btn-wrapper {
661   > .btn {
662     margin-bottom: $spacer * 0.25;
663   }
664 }
665
666 /* Force LTR/RTL alignment for placeholder text */
667
668 .form-control::placeholder {
669   text-align: left;
670 }
671
672 /* Rules for export sidebar */
673
674 .export_form {
675   .export_area_inputs,
676   .export_button {
677     text-align: center;
678   }
679
680   .export_area_inputs {
681     margin-bottom: $spacer;
682     input[type="text"] {
683       width: 100px;
684       text-align: center;
685     }
686   }
687
688   .export_boxy {
689     background: $lightgrey;
690
691     #maxlat { margin-top: -1px; }
692     #minlon {
693       float: left;
694       /*rtl:ignore*/ margin-left: -1px;
695     }
696     #maxlon {
697       float: right;
698       /*rtl:ignore*/ margin-right: -1px;
699     }
700     #minlat { margin-bottom: -1px; }
701   }
702 }
703
704 /* Rules for edit pages */
705
706 .site-edit {
707   #content {
708     position: absolute;
709     top: $headerHeight;
710     bottom: 0;
711     width: 100%;
712   }
713 }
714
715 /* Rules for non-map content pages */
716
717 .content-inner {
718   position: relative;
719   max-width: 960px;
720   margin: auto;
721   padding: $lineheight;
722 }
723
724 /* Overrides for pages that use new layout conventions */
725
726 .header-illustration {
727   background-position: 0 0;
728   background-repeat: no-repeat;
729   position: relative;
730   min-height: 200px;
731   width: 100%;
732   left: 0;
733   bottom: 0;
734
735   &.new-user-main {
736     background-image: image-url("sign-up-illustration.png");
737   }
738
739   &.confirm-main {
740     background-image: image-url("confirm-illustration.png");
741   }
742
743   &.new-user-terms {
744     background-image: image-url("terms-illustration.png");
745   }
746
747   &.new-user-arm {
748     height: 110px;
749     width: 130px;
750     left: 280px;
751     top: 180px;
752     background-image: image-url("sign-up-illustration-arm.png");
753     position: absolute;
754     z-index: 100;
755     pointer-events: none;
756   }
757 }
758
759 [dir=rtl] .header-illustration {
760   transform: scaleX(-1);
761
762   h1 {
763     transform: scaleX(-1);
764   }
765 }
766
767 /* Rules for small maps in content areas */
768
769 .content_map {
770   height: 200px;
771   margin-bottom: $lineheight;
772 }
773
774 @include media-breakpoint-up(md) {
775   .content_map {
776     height: 400px;
777   }
778 }
779
780 /* Rules for the user map */
781
782 .content_map .leaflet-popup-content {
783   margin: $spacer;
784   min-height: 50px;
785 }
786
787 /* Rules for user popups on maps */
788
789 .user_popup {
790   min-width: 200px;
791   p {
792     padding: 0 0 5px 0;
793     margin: 0 0 0 60px;
794     font-size: 12px;
795   }
796 }
797
798 /* Rules for the diary entry page */
799
800 .diary_entries {
801   #map {
802     height: 400px;
803     display: none;
804   }
805   .diary-comment .col-auto {
806     width: 62px;
807   }
808   .diary-comment .col {
809     max-width: 690px;
810   }
811 }
812
813 /* Rules for the account confirmation page */
814
815 .users-terms {
816   .legale {
817     padding: $lineheight;
818     margin-bottom: $lineheight;
819     overflow: auto;
820     height: 20em;
821
822     li {
823       list-style: inherit;
824     }
825
826     ol ol {
827       list-style-type: lower-alpha;
828     }
829   }
830 }
831
832 /* Rules for messages pages */
833
834 .messages {
835   .inbox-row {
836     background: $offwhite;
837   }
838
839   .inbox-row-unread td {
840     background: #CBEEA7;
841   }
842 }
843
844 .search_form {
845   #query {
846     z-index: 0;
847   }
848
849   .describe_location {
850     font-size: 10px;
851   }
852 }
853
854 /* Rules for user images */
855
856 img.user_image {
857   max-width: 100px;
858   max-height: 100px;
859 }
860
861 img.user_thumbnail {
862   max-width: 50px;
863   max-height: 50px;
864 }
865
866 img.user_thumbnail_tiny {
867   width: 25px;
868   height: 25px;
869   object-fit: contain;
870 }
871
872 /* General styles for action lists / subnavs */
873
874 nav.secondary-actions {
875   margin-left: -11px;
876   overflow: hidden;
877   > ul {
878     display: flex;
879     flex-direction: row;
880     flex-wrap: wrap;
881     margin-bottom: 0;
882     margin-left: -1px;
883     padding: 0;
884     > li {
885       flex-basis: auto;
886       list-style: none;
887       border-left: 1px solid $grey;
888       padding-left: $lineheight * 0.5;
889       margin-right: $lineheight * 0.5;
890       margin-bottom: $lineheight * 0.125;
891     }
892   }
893 }
894
895 div.secondary-actions {
896   padding: 10px;
897   text-align: center;
898 }
899
900 /* Rules for rich text */
901
902 .richtext,
903 .prose {
904   code {
905     background: $lightgrey;
906     padding: 2px 3px;
907   }
908
909   pre {
910     background: $lightgrey;
911     padding: 2px 3px;
912     white-space: pre-wrap;
913
914     code {
915       padding: 0;
916     }
917   }
918
919   img {
920     padding: $lineheight;
921     background-color: $offwhite;
922     display: block;
923     max-width: 100%;
924     margin: auto;
925   }
926
927   blockquote {
928     border-left: $lineheight solid $offwhite;
929     padding-left: $lineheight;
930     margin: 0;
931     color: $darkgrey;
932   }
933 }
934
935 /* Rules for the "Welcome" page */
936 .site-welcome, .site-fixthemap {
937   .sprite {
938     background-image: image-url("welcome-sprite.png");
939     background-size: 500px 250px;
940     display: block;
941   }
942
943   .sprite.small {
944     width: 50px;
945     height: 50px;
946   }
947
948   .sprite.x {
949     /*rtl:ignore*/ background-position: -50px 0;
950   }
951
952   .sprite.term {
953     margin-right: 10px;
954     vertical-align: middle;
955   }
956
957   .sprite.node {
958     /*rtl:ignore*/ background-position: -100px 0;
959   }
960
961   .sprite.way {
962     /*rtl:ignore*/ background-position: -150px 0;
963   }
964
965   .sprite.tag {
966     /*rtl:ignore*/ background-position: -200px 0;
967   }
968
969   .sprite.editor {
970     /*rtl:ignore*/ background-position: -250px 0;
971   }
972
973   .sprite.question {
974     /*rtl:ignore*/ background-position: -300px 0;
975   }
976
977   .sprite.rules {
978     /*rtl:ignore*/ background-position: -350px 0;
979   }
980
981   .icon.note {
982     background-color: #333;
983     border-radius: 4px;
984   }
985 }
986
987 .site-about #content {
988   background-color: $lightgrey;
989
990   .content-inner {
991     max-width: 760px;
992   }
993
994   .attr {
995     margin-top: -20px;
996
997     h1 {
998       span {
999         color: $vibrant-green;
1000       }
1001     }
1002
1003     .user-image {
1004       height: 150px;
1005       background-position: 0 50%;
1006       background-repeat: no-repeat;
1007       background-image: image-url('about/osm.png');
1008       background-size: cover;
1009       background-color: $vibrant-green;
1010     }
1011
1012     .byosm {
1013       background: $vibrant-green;
1014     }
1015
1016     .byosm span {
1017       display: inline-block;
1018       width: 1em;
1019       margin-left: -1em;
1020     }
1021   }
1022
1023   .icon {
1024     width: 30px;
1025     height: 30px;
1026     background: 40px 40px image-url('about/sprite.png') no-repeat;
1027
1028     &.local {
1029       /*rtl:ignore*/
1030       background-position: 0px 0px;
1031     }
1032     &.community {
1033       /*rtl:ignore*/
1034       background-position: 0px -40px;
1035     }
1036     &.open {
1037       /*rtl:ignore*/
1038       background-position: 0px -80px;
1039     }
1040     &.partners {
1041       /*rtl:ignore*/
1042       background-position: 0px -120px;
1043     }
1044     &.infringement {
1045       /*rtl:ignore*/
1046       background-position: 0px -160px;
1047     }
1048     &.legal {
1049       /*rtl:ignore*/
1050       background-position: -45px -160px;
1051     }
1052   }
1053 }
1054
1055 /* Rules for tabs inside secondary background sections */
1056
1057 .bg-body-secondary .nav-tabs {
1058   --bs-border-color: var(--bs-secondary-border-subtle);
1059   --bs-secondary-bg: var(--bs-secondary-border-subtle);
1060   margin-bottom: -1px;
1061 }
1062
1063 @import 'browse';