]> git.openstreetmap.org Git - rails.git/blob - app/assets/stylesheets/common.scss
d598d10e3aa996bc198569d3c8bd37e810056ce5
[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     .colour-preview-box {
650       width: 14px;
651       height: 14px;
652       // add color via inline css on element: background-color: <tag value>;
653     }
654   }
655
656   span.action-button:hover {
657     cursor: pointer;
658     text-decoration: underline;
659   }
660
661   .note-description {
662     overflow: hidden;
663     margin: 0 0 10px 10px;
664   }
665
666   .query-results {
667     display: none;
668
669     ul {
670       li {
671         &.query-result {
672           cursor: pointer;
673         }
674
675         &.selected {
676           background: $list-highlight;
677         }
678       }
679     }
680   }
681 }
682
683 /* Bootstrap buttons don't have any vertical margin, so
684    they touch when adjacent buttons wrap onto a new line
685    e.g. wide form buttons on a narrow sidebar */
686
687 .btn-wrapper {
688   > .btn {
689     margin-bottom: $spacer * 0.25;
690   }
691 }
692
693 /* Force LTR/RTL alignment for placeholder text */
694
695 .form-control::placeholder {
696   text-align: left;
697 }
698
699 /* Rules for export sidebar */
700
701 .export_form {
702   .export_area_inputs,
703   .export_button {
704     text-align: center;
705   }
706
707   .export_area_inputs {
708     margin-bottom: $spacer;
709     input[type="text"] {
710       width: 100px;
711       text-align: center;
712     }
713   }
714
715   .export_boxy {
716     background: $lightgrey;
717
718     #maxlat { margin-top: -1px; }
719     #minlon {
720       float: left;
721       /*rtl:ignore*/ margin-left: -1px;
722     }
723     #maxlon {
724       float: right;
725       /*rtl:ignore*/ margin-right: -1px;
726     }
727     #minlat { margin-bottom: -1px; }
728   }
729 }
730
731 /* Rules for edit pages */
732
733 .site-edit {
734   #content {
735     position: absolute;
736     top: $headerHeight;
737     bottom: 0;
738     width: 100%;
739   }
740 }
741
742 /* Rules for non-map content pages */
743
744 .content-heading {
745   background: $lightgrey;
746 }
747
748 .content-inner {
749   position: relative;
750   max-width: 960px;
751   margin: auto;
752   padding: $lineheight;
753 }
754
755 /* Overrides for pages that use new layout conventions */
756
757 .header-illustration {
758   background-position: 0 0;
759   background-repeat: no-repeat;
760   position: relative;
761   min-height: 200px;
762   width: 100%;
763   left: 0;
764   bottom: 0;
765
766   &.new-user-main {
767     background-image: image-url("sign-up-illustration.png");
768   }
769
770   &.confirm-main {
771     background-image: image-url("confirm-illustration.png");
772   }
773
774   &.new-user-terms {
775     background-image: image-url("terms-illustration.png");
776   }
777
778   &.new-user-arm {
779     height: 110px;
780     width: 130px;
781     left: 280px;
782     top: 180px;
783     background-image: image-url("sign-up-illustration-arm.png");
784     position: absolute;
785     z-index: 100;
786     pointer-events: none;
787   }
788 }
789
790 [dir=rtl] .header-illustration {
791   transform: scaleX(-1);
792
793   h1 {
794     transform: scaleX(-1);
795   }
796 }
797
798 /* Rules for small maps in content areas */
799
800 .content_map {
801   height: 200px;
802   margin-bottom: $lineheight;
803 }
804
805 @include media-breakpoint-up(md) {
806   .content_map {
807     height: 400px;
808   }
809 }
810
811 /* Rules for the user map */
812
813 .content_map .leaflet-popup-content {
814   margin: $spacer;
815   min-height: 50px;
816 }
817
818 /* Rules for user popups on maps */
819
820 .user_popup {
821   min-width: 200px;
822   p {
823     padding: 0 0 5px 0;
824     margin: 0 0 0 60px;
825     font-size: 12px;
826   }
827 }
828
829 /* Rules for the diary entry page */
830
831 .diary_entries {
832   #map {
833     height: 400px;
834     display: none;
835   }
836   .comments {
837     max-width: 740px;
838   }
839   .diary-comment {
840     border-top: 1px dashed $grey;
841     &:first-child {
842       border-top: 1px solid $grey;
843     }
844   }
845 }
846
847 /* Rules for the account confirmation page */
848
849 .users-terms {
850   .legale {
851     padding: $lineheight;
852     margin-bottom: $lineheight;
853     overflow: auto;
854     height: 20em;
855
856     li {
857       list-style: inherit;
858     }
859
860     ol ol {
861       list-style-type: lower-alpha;
862     }
863   }
864 }
865
866 /* Rules for messages pages */
867
868 .messages {
869   .inbox-row {
870     background: $offwhite;
871   }
872
873   .inbox-row-unread td {
874     background: #CBEEA7;
875   }
876 }
877
878 .search_form {
879   background-color: $lightgrey;
880
881   #query {
882     z-index: 0;
883   }
884
885   .describe_location {
886     font-size: 10px;
887   }
888 }
889
890 .directions_form {
891   background-color: $lightgrey;
892 }
893
894 /* Rules for user images */
895
896 img.user_image {
897   max-width: 100px;
898   max-height: 100px;
899 }
900
901 img.user_thumbnail {
902   max-width: 50px;
903   max-height: 50px;
904 }
905
906 img.user_thumbnail_tiny {
907   width: 25px;
908   height: 25px;
909   object-fit: contain;
910 }
911
912 /* General styles for action lists / subnavs */
913
914 nav.secondary-actions {
915   margin-left: -11px;
916   overflow: hidden;
917   > ul {
918     display: flex;
919     flex-direction: row;
920     flex-wrap: wrap;
921     margin-bottom: 0;
922     margin-left: -1px;
923     padding: 0;
924     > li {
925       flex-basis: auto;
926       list-style: none;
927       border-left: 1px solid $grey;
928       padding-left: $lineheight * 0.5;
929       margin-right: $lineheight * 0.5;
930       margin-bottom: $lineheight * 0.125;
931     }
932   }
933 }
934
935 div.secondary-actions {
936   padding: 10px;
937   text-align: center;
938 }
939
940 /* Rules for rich text */
941
942 .richtext,
943 .prose {
944   code {
945     background: $lightgrey;
946     padding: 2px 3px;
947   }
948
949   pre {
950     background: $lightgrey;
951     padding: 2px 3px;
952     white-space: pre-wrap;
953
954     code {
955       padding: 0;
956     }
957   }
958
959   img {
960     padding: $lineheight;
961     background-color: $offwhite;
962     display: block;
963     max-width: 100%;
964     margin: auto;
965   }
966
967   blockquote {
968     border-left: $lineheight solid $offwhite;
969     padding-left: $lineheight;
970     margin: 0;
971     color: $darkgrey;
972   }
973 }
974
975 /* Rules for the "Welcome" page */
976 .site-welcome, .site-fixthemap {
977   .sprite {
978     background-image: image-url("welcome-sprite.png");
979     background-size: 500px 250px;
980     display: block;
981   }
982
983   .sprite.small {
984     width: 50px;
985     height: 50px;
986   }
987
988   .sprite.x {
989     /*rtl:ignore*/ background-position: -50px 0;
990   }
991
992   .sprite.term {
993     margin-right: 10px;
994     vertical-align: middle;
995   }
996
997   .sprite.node {
998     /*rtl:ignore*/ background-position: -100px 0;
999   }
1000
1001   .sprite.way {
1002     /*rtl:ignore*/ background-position: -150px 0;
1003   }
1004
1005   .sprite.tag {
1006     /*rtl:ignore*/ background-position: -200px 0;
1007   }
1008
1009   .sprite.editor {
1010     /*rtl:ignore*/ background-position: -250px 0;
1011   }
1012
1013   .sprite.question {
1014     /*rtl:ignore*/ background-position: -300px 0;
1015   }
1016
1017   .sprite.rules {
1018     /*rtl:ignore*/ background-position: -350px 0;
1019   }
1020
1021   .icon.note {
1022     background-color: #333;
1023     border-radius: 4px;
1024   }
1025 }
1026
1027 .site-about #content {
1028   background-color: $lightgrey;
1029
1030   .content-inner {
1031     max-width: 760px;
1032   }
1033
1034   .attr {
1035     margin-top: -20px;
1036
1037     h1 {
1038       span {
1039         color: $vibrant-green;
1040       }
1041     }
1042
1043     .user-image {
1044       height: 150px;
1045       background-position: 0 50%;
1046       background-repeat: no-repeat;
1047       background-image: image-url('about/osm.png');
1048       background-size: cover;
1049       background-color: $vibrant-green;
1050     }
1051
1052     .byosm {
1053       background: $vibrant-green;
1054     }
1055
1056     .byosm span {
1057       display: inline-block;
1058       width: 1em;
1059       margin-left: -1em;
1060     }
1061   }
1062
1063   .icon {
1064     width: 30px;
1065     height: 30px;
1066     background: 40px 40px image-url('about/sprite.png') no-repeat;
1067
1068     &.local {
1069       /*rtl:ignore*/
1070       background-position: 0px 0px;
1071     }
1072     &.community {
1073       /*rtl:ignore*/
1074       background-position: 0px -40px;
1075     }
1076     &.open {
1077       /*rtl:ignore*/
1078       background-position: 0px -80px;
1079     }
1080     &.partners {
1081       /*rtl:ignore*/
1082       background-position: 0px -120px;
1083     }
1084     &.infringement {
1085       /*rtl:ignore*/
1086       background-position: 0px -160px;
1087     }
1088     &.legal {
1089       /*rtl:ignore*/
1090       background-position: -45px -160px;
1091     }
1092   }
1093 }
1094
1095 @import 'browse';