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