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