]> git.openstreetmap.org Git - rails.git/blob - app/assets/stylesheets/common.scss
Use secondary body color in search/direction forms
[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-inner {
723   position: relative;
724   max-width: 960px;
725   margin: auto;
726   padding: $lineheight;
727 }
728
729 /* Overrides for pages that use new layout conventions */
730
731 .header-illustration {
732   background-position: 0 0;
733   background-repeat: no-repeat;
734   position: relative;
735   min-height: 200px;
736   width: 100%;
737   left: 0;
738   bottom: 0;
739
740   &.new-user-main {
741     background-image: image-url("sign-up-illustration.png");
742   }
743
744   &.confirm-main {
745     background-image: image-url("confirm-illustration.png");
746   }
747
748   &.new-user-terms {
749     background-image: image-url("terms-illustration.png");
750   }
751
752   &.new-user-arm {
753     height: 110px;
754     width: 130px;
755     left: 280px;
756     top: 180px;
757     background-image: image-url("sign-up-illustration-arm.png");
758     position: absolute;
759     z-index: 100;
760     pointer-events: none;
761   }
762 }
763
764 [dir=rtl] .header-illustration {
765   transform: scaleX(-1);
766
767   h1 {
768     transform: scaleX(-1);
769   }
770 }
771
772 /* Rules for small maps in content areas */
773
774 .content_map {
775   height: 200px;
776   margin-bottom: $lineheight;
777 }
778
779 @include media-breakpoint-up(md) {
780   .content_map {
781     height: 400px;
782   }
783 }
784
785 /* Rules for the user map */
786
787 .content_map .leaflet-popup-content {
788   margin: $spacer;
789   min-height: 50px;
790 }
791
792 /* Rules for user popups on maps */
793
794 .user_popup {
795   min-width: 200px;
796   p {
797     padding: 0 0 5px 0;
798     margin: 0 0 0 60px;
799     font-size: 12px;
800   }
801 }
802
803 /* Rules for the diary entry page */
804
805 .diary_entries {
806   #map {
807     height: 400px;
808     display: none;
809   }
810   .diary-comment .col-auto {
811     width: 62px;
812   }
813   .diary-comment .col {
814     max-width: 690px;
815   }
816 }
817
818 /* Rules for the account confirmation page */
819
820 .users-terms {
821   .legale {
822     padding: $lineheight;
823     margin-bottom: $lineheight;
824     overflow: auto;
825     height: 20em;
826
827     li {
828       list-style: inherit;
829     }
830
831     ol ol {
832       list-style-type: lower-alpha;
833     }
834   }
835 }
836
837 /* Rules for messages pages */
838
839 .messages {
840   .inbox-row {
841     background: $offwhite;
842   }
843
844   .inbox-row-unread td {
845     background: #CBEEA7;
846   }
847 }
848
849 .search_form {
850   #query {
851     z-index: 0;
852   }
853
854   .describe_location {
855     font-size: 10px;
856   }
857 }
858
859 /* Rules for user images */
860
861 img.user_image {
862   max-width: 100px;
863   max-height: 100px;
864 }
865
866 img.user_thumbnail {
867   max-width: 50px;
868   max-height: 50px;
869 }
870
871 img.user_thumbnail_tiny {
872   width: 25px;
873   height: 25px;
874   object-fit: contain;
875 }
876
877 /* General styles for action lists / subnavs */
878
879 nav.secondary-actions {
880   margin-left: -11px;
881   overflow: hidden;
882   > ul {
883     display: flex;
884     flex-direction: row;
885     flex-wrap: wrap;
886     margin-bottom: 0;
887     margin-left: -1px;
888     padding: 0;
889     > li {
890       flex-basis: auto;
891       list-style: none;
892       border-left: 1px solid $grey;
893       padding-left: $lineheight * 0.5;
894       margin-right: $lineheight * 0.5;
895       margin-bottom: $lineheight * 0.125;
896     }
897   }
898 }
899
900 div.secondary-actions {
901   padding: 10px;
902   text-align: center;
903 }
904
905 /* Rules for rich text */
906
907 .richtext,
908 .prose {
909   code {
910     background: $lightgrey;
911     padding: 2px 3px;
912   }
913
914   pre {
915     background: $lightgrey;
916     padding: 2px 3px;
917     white-space: pre-wrap;
918
919     code {
920       padding: 0;
921     }
922   }
923
924   img {
925     padding: $lineheight;
926     background-color: $offwhite;
927     display: block;
928     max-width: 100%;
929     margin: auto;
930   }
931
932   blockquote {
933     border-left: $lineheight solid $offwhite;
934     padding-left: $lineheight;
935     margin: 0;
936     color: $darkgrey;
937   }
938 }
939
940 /* Rules for the "Welcome" page */
941 .site-welcome, .site-fixthemap {
942   .sprite {
943     background-image: image-url("welcome-sprite.png");
944     background-size: 500px 250px;
945     display: block;
946   }
947
948   .sprite.small {
949     width: 50px;
950     height: 50px;
951   }
952
953   .sprite.x {
954     /*rtl:ignore*/ background-position: -50px 0;
955   }
956
957   .sprite.term {
958     margin-right: 10px;
959     vertical-align: middle;
960   }
961
962   .sprite.node {
963     /*rtl:ignore*/ background-position: -100px 0;
964   }
965
966   .sprite.way {
967     /*rtl:ignore*/ background-position: -150px 0;
968   }
969
970   .sprite.tag {
971     /*rtl:ignore*/ background-position: -200px 0;
972   }
973
974   .sprite.editor {
975     /*rtl:ignore*/ background-position: -250px 0;
976   }
977
978   .sprite.question {
979     /*rtl:ignore*/ background-position: -300px 0;
980   }
981
982   .sprite.rules {
983     /*rtl:ignore*/ background-position: -350px 0;
984   }
985
986   .icon.note {
987     background-color: #333;
988     border-radius: 4px;
989   }
990 }
991
992 .site-about #content {
993   background-color: $lightgrey;
994
995   .content-inner {
996     max-width: 760px;
997   }
998
999   .attr {
1000     margin-top: -20px;
1001
1002     h1 {
1003       span {
1004         color: $vibrant-green;
1005       }
1006     }
1007
1008     .user-image {
1009       height: 150px;
1010       background-position: 0 50%;
1011       background-repeat: no-repeat;
1012       background-image: image-url('about/osm.png');
1013       background-size: cover;
1014       background-color: $vibrant-green;
1015     }
1016
1017     .byosm {
1018       background: $vibrant-green;
1019     }
1020
1021     .byosm span {
1022       display: inline-block;
1023       width: 1em;
1024       margin-left: -1em;
1025     }
1026   }
1027
1028   .icon {
1029     width: 30px;
1030     height: 30px;
1031     background: 40px 40px image-url('about/sprite.png') no-repeat;
1032
1033     &.local {
1034       /*rtl:ignore*/
1035       background-position: 0px 0px;
1036     }
1037     &.community {
1038       /*rtl:ignore*/
1039       background-position: 0px -40px;
1040     }
1041     &.open {
1042       /*rtl:ignore*/
1043       background-position: 0px -80px;
1044     }
1045     &.partners {
1046       /*rtl:ignore*/
1047       background-position: 0px -120px;
1048     }
1049     &.infringement {
1050       /*rtl:ignore*/
1051       background-position: 0px -160px;
1052     }
1053     &.legal {
1054       /*rtl:ignore*/
1055       background-position: -45px -160px;
1056     }
1057   }
1058 }
1059
1060 /* Rules for tabs inside secondary background sections */
1061
1062 .bg-body-secondary .nav-tabs {
1063   --bs-border-color: var(--bs-secondary-border-subtle);
1064   --bs-secondary-bg: var(--bs-secondary-border-subtle);
1065   margin-bottom: -1px;
1066 }
1067
1068 @import 'browse';