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