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