]> git.openstreetmap.org Git - rails.git/blob - app/assets/stylesheets/common.scss
Remove controls sprite
[rails.git] / app / assets / stylesheets / common.scss
1 @use "sass:map";
2 @import "parameters";
3 @import "bootstrap";
4 @import "rails_bootstrap_forms";
5
6 /* Styles common to large and small screens */
7
8 /* Default rules for the body of every page */
9
10 body {
11   font-size: $typeheight;
12   --dark-mode-map-filter: none;
13 }
14
15 time[title] {
16   text-decoration: underline dotted;
17 }
18
19 /* Utility for de-emphasizing content */
20
21 .text-body-secondary a {
22   color: $blue;
23 }
24
25 /* Bootstrap contextual table classes overrides in dark mode */
26
27 @include color-mode(dark) {
28   .table-primary {
29     --bs-table-bg: rgb(var(--bs-primary-rgb), .25);
30   }
31   .table-secondary {
32     --bs-table-bg: rgb(var(--bs-secondary-rgb), .25);
33   }
34   .table-success {
35     --bs-table-bg: rgb(var(--bs-success-rgb), .25);
36   }
37   .table-primary, .table-secondary, .table-success {
38     --bs-table-color: initial;
39     border-color: inherit;
40   }
41 }
42
43 /* Utility for delayed loading spinner */
44
45 .delayed-fade-in {
46   animation: 300ms linear forwards delayed-fade-in;
47 }
48
49 @keyframes delayed-fade-in {
50   0%   { opacity: 0 }
51   66%  { opacity: 0 }
52   100% { opacity: 1 }
53 }
54
55 /* Bootstrap close button overrides for nested light/dark themes */
56
57 [data-bs-theme="dark"],
58 [data-bs-theme] [data-bs-theme="dark"] {
59   --bs-btn-close-filter: invert(1) grayscale(100%) brightness(200%);
60 }
61
62 [data-bs-theme="light"],
63 [data-bs-theme] [data-bs-theme="light"] {
64   --bs-btn-close-filter: none;
65 }
66
67 /* Rules for the header */
68
69 #menu-icon {
70   display: none;
71   position: absolute;
72   top: 0;
73   right: 0;
74   background: image-url("menu-icon.svg") no-repeat;
75   background-size: 30px 30px;
76   width: 30px;
77   height: 30px;
78   margin: 14px 10px 0 0;
79   opacity: 0.6;
80 }
81
82 @include color-mode(dark) {
83   #menu-icon {
84     filter: invert(1);
85   }
86 }
87
88 header {
89   height: $headerHeight;
90   position: relative;
91   font-size: 14px;
92
93   > * {
94     padding: $lineheight * 0.5;
95   }
96
97   h1 {
98     height: $headerHeight;
99     font-size: 18px;
100   }
101
102   .btn {
103     font-size: 14px;
104   }
105
106   .username {
107     max-width: 12em;
108   }
109 }
110
111 nav.primary {
112   #edit_tab .btn-outline-primary {
113     @include button-outline-variant($green, $color-hover: $white, $active-color: $white);
114   }
115
116   .disabled {
117     .btn-outline-primary {
118       color: $grey;
119       cursor: default;
120
121       .caret {
122         border-top-color: $grey;
123       }
124
125       &:hover {
126         background-color: lighten($green, 30%);
127       }
128     }
129   }
130
131   // Small tweaks to the toggle to stop the primary colour showing through
132   // when the menu is shown
133   .show > .btn-outline-primary.dropdown-toggle {
134     background-color: $green;
135     border-color: $green;
136
137     &:focus {
138       box-shadow: 0 0 0 0.2rem fade-out($green, 0.5);
139     }
140   }
141 }
142
143 nav.secondary {
144   .nav-link {
145     padding: 0 0.3rem;
146   }
147
148   > ul {
149     height: 1.5em;
150   }
151 }
152
153 nav.primary, nav.secondary {
154   .dropdown-item {
155     &:hover, &:active {
156       background-color: $green;
157       color: white;
158     }
159   }
160 }
161
162 #compact-secondary-nav {
163   display: none;
164 }
165
166 body.small-nav {
167   #menu-icon {
168     display: block;
169   }
170
171   header {
172     flex-direction: column;
173     height: auto;
174     min-height: $headerHeight;
175
176     &.closed nav {
177       display: none !important;
178     }
179
180     .search_forms {
181       display: block;
182     }
183
184     .username {
185       max-width: unset;
186     }
187   }
188
189   #sidebar .search_forms {
190     display: none;
191   }
192
193   nav.primary {
194     margin-right: 0;
195     padding: 0;
196
197     #edit_tab {
198       width: 100%;
199       padding: 10px;
200     }
201   }
202
203   nav.secondary {
204     flex-direction: column;
205
206     > ul {
207       height: auto;
208       justify-content: center;
209     }
210
211     .user-menu, .login-menu {
212       width: 100%;
213     }
214   }
215
216   #compact-secondary-nav {
217     display: none;
218   }
219
220   .compact-hide {
221     display: inline-block;
222   }
223
224   .overlay-sidebar #sidebar .welcome {
225     display: none;
226   }
227
228   .overlay-sidebar #sidebar #banner {
229     display: none;
230   }
231 }
232
233 /* Utility for styling notification numbers */
234
235 .count-number {
236   background: transparentize(lighten($green, 25%), .25);
237   color: $gray-800;
238   font-weight: $font-weight-normal;
239 }
240
241 /* Rules for Leaflet maps */
242
243 .leaflet-top.leaflet-right,
244 .leaflet-top.leaflet-left {
245   height: 100%;
246   column-gap: 10px;
247   display: flex;
248   flex-direction: column;
249   flex-wrap: wrap-reverse;
250 }
251
252 .leaflet-control .control-button {
253   display: block;
254   height: 40px;
255   width: 40px;
256   color: white;
257   padding: 10px;
258   background-color: #333;
259   background-color: rgba(0,0,0,.6);
260   outline: none;
261
262   &:hover,
263   &:focus {
264     background-color: black;
265   }
266
267   &.disabled,
268   &.leaflet-disabled {
269     background-color: #333;
270     background-color: rgba(0,0,0,.5);
271     cursor: default;
272   }
273
274   &-first {
275     border-start-start-radius: 4px;
276   }
277
278   &-last {
279     border-end-start-radius: 4px;
280     margin-bottom: 10px;
281   }
282 }
283
284 .leaflet-control.active .control-button {
285   background-color: $vibrant-green;
286 }
287
288 /* Rules for the sidebar and main map area */
289
290 .map-layout {
291   #content {
292     overflow: hidden;
293     position: absolute;
294     top: $headerHeight;
295     bottom: 0;
296     width: 100%;
297   }
298
299   #sidebar, #map {
300     position: relative;
301     height: 100%;
302     overflow-x: hidden;
303     overflow-y: auto;
304   }
305
306   #sidebar {
307     float: left;
308     width: $sidebarWidth;
309   }
310
311   .overlay-sidebar #sidebar {
312     position: absolute;
313     height: auto;
314     overflow: hidden;
315
316     #banner {
317       display: block;
318     }
319
320     .welcome {
321       display: block;
322     }
323
324     .sidebar-close-controls,
325     #sidebar_loader,
326     #sidebar_content {
327       display: none;
328     }
329   }
330
331   .welcome {
332     display: none;
333   }
334
335   #banner {
336     display: none;
337
338     img {
339       display: block;
340       width: $sidebarWidth;
341     }
342   }
343
344   #map {
345     height: 100%;
346     overflow: hidden;
347
348     &.query-active {
349       cursor: help;
350     }
351
352     &.query-disabled {
353       cursor: not-allowed;
354     }
355
356     .leaflet-marker-draggable {
357       cursor: move;
358     }
359
360     .query-marker {
361       animation: 1500ms forwards query-marker-fade;
362
363       @keyframes query-marker-fade {
364         to { opacity: 0 }
365       }
366     }
367   }
368
369   #map-ui {
370     display: none;
371     position: relative;
372     float: right;
373     width: 250px;
374     height: 100%;
375     overflow: auto;
376   }
377 }
378
379 @include media-breakpoint-down(md) {
380   body.map-layout {
381     #sidebar, #map {
382       position: relative;
383       overflow-x: hidden;
384       width: 100%;
385       height: 50%;
386     }
387
388     #map-ui {
389       width: 100%;
390       height: 50%;
391       overflow-y: scroll;
392     }
393
394     .overlay-sidebar.overlay-right-sidebar {
395       #sidebar {
396         position: absolute;
397         width: 350px;
398         height: auto;
399         overflow: hidden;
400       }
401
402       #map {
403         height: 100%;
404       }
405     }
406   }
407 }
408
409 .layers-ui {
410   .base-layers > * {
411     height: 3.5rem;
412
413     > .btn {
414       box-sizing: content-box;
415       top: - map.get($border-widths, 4);
416       left: - map.get($border-widths, 4);
417       --bs-btn-border-color: var(--bs-body-bg);
418     }
419     > .btn:hover {
420       --bs-btn-border-color: var(--bs-primary-border-subtle);
421     }
422   }
423
424   .overlay-layers {
425     li.disabled { color: $darkgrey; }
426   }
427 }
428
429 .share-ui {
430   #mapnik_scale {
431     width: 100px;
432   }
433 }
434
435 .leaflet-top {
436   top: 10px !important;
437   .leaflet-control {
438     margin-right: 0px !important;
439     margin-top: 0px !important;
440   }
441 }
442
443 .leaflet-popup-scrolled {
444   padding-right: $lineheight;
445   border-bottom: 0px !important;
446   border-top: 0px !important;
447 }
448
449 .leaflet-popup-content-wrapper, .leaflet-popup-tip,
450 .leaflet-contextmenu, .leaflet-contextmenu-item,
451 .leaflet-control-attribution, .leaflet-control-scale-line {
452   @extend .bg-body, .text-body;
453 }
454
455 .leaflet-control-attribution, .leaflet-control-scale-line {
456   @extend .bg-opacity-75;
457   text-shadow: none !important;
458 }
459
460 .leaflet-contextmenu-item.over {
461   @extend .bg-body-secondary, .border-secondary, .border-opacity-10;
462 }
463
464 .leaflet-popup-content-wrapper {
465   @extend .rounded-1;
466
467   a {
468     color: var(--bs-link-color) !important;
469   }
470 }
471
472 @include color-mode(dark) {
473   .leaflet-container .leaflet-control-attribution a {
474     color: var(--bs-link-color);
475   }
476
477   .leaflet-control-scale-line {
478     border-color: rgba(var(--bs-light-rgb), .75) !important;
479   }
480 }
481
482 @mixin dark-map-color-scheme {
483   .leaflet-tile-container,
484   .mapkey-table-entry td:first-child > * {
485     filter: var(--dark-mode-map-filter);
486   }
487
488   .leaflet-tile-container .leaflet-tile {
489     filter: none;
490   }
491 }
492
493 body[data-map-theme="dark"] {
494   @include dark-map-color-scheme;
495 }
496
497 @include color-mode(dark) {
498   body:not([data-map-theme]) {
499     @include dark-map-color-scheme;
500   }
501 }
502
503 /* Rules for attribution text under the main map shown on printouts */
504
505 .donate-attr { color: darken($green, 10%) !important; }
506
507 /* Temporary label size override until we remove site-wide font customisation */
508
509 form {
510   label {
511     font-size: 16px;
512   }
513   .col-form-label {
514     font-size: 16px;
515   }
516 }
517
518 /* Stop bootstrap 5 from floating legends when they don't need to be */
519 legend {
520   float: none;
521 }
522
523 /* Override the text colour for primary and secondary buttons, to match our
524    bootstrap 4 colours. Note this has accessibility issues, which is why
525    bootstrap 5 calculates black as the appropriate colour, and we should
526    reconsider our colours at some point with that in mind. */
527
528 .btn-primary {
529   @include button-variant($primary, $primary, $color: $white, $hover-color: $white, $active-color: $white, $disabled-color: $white);
530 }
531
532 .btn-secondary {
533   @include button-variant($secondary, $secondary, $color: $white, $hover-color: $white, $active-color: $white, $disabled-color: $white);
534 }
535
536 .btn-outline-secondary {
537   @include button-outline-variant($secondary, $color-hover: $white, $active-color: $white);
538 }
539
540 /* Rules for the search and direction forms */
541
542 header .search_forms,
543 .directions_form {
544   display: none;
545 }
546
547 .search_form {
548   .describe_location {
549     font-size: 10px;
550   }
551 }
552
553 /* Rules for routing */
554
555 td.distance {
556     font-size: x-small;
557 }
558 tr.turn {
559     cursor: pointer;
560 }
561
562 .routing_marker_column {
563   margin-left: .35rem;
564   margin-right: .35rem;
565   width: 15px;
566
567   img {
568     cursor: move;
569   }
570 }
571
572 /* Rules for the history sidebar */
573
574 .changeset-above-sidebar-viewport {
575   --changeset-border-color: #CC6655;
576   --changeset-fill-color: #DDBBBB;
577   --changeset-outline-color: #FFF4F4;
578 }
579 .changeset-in-sidebar-viewport {
580   --changeset-border-color: #FF9500;
581   &.changeset-highlighted {
582     --changeset-border-color: #FF6600;
583   }
584   --changeset-fill-color: #FFFFAF;
585   --changeset-outline-color: #FFFFFF;
586 }
587 .changeset-below-sidebar-viewport {
588   --changeset-border-color: #8888AA;
589   --changeset-fill-color: #CCCCDD;
590   --changeset-outline-color: #F4F4FF;
591 }
592
593 #sidebar .changesets {
594   .changeset-color-hint-bar {
595     height: 2px;
596     background: var(--changeset-border-color);
597   }
598
599   li {
600     &.selected {
601       @extend :hover;
602     }
603
604     a.stretched-link > span, a:not(.stretched-link), [title] {
605       position: relative;
606       z-index: 2; /* needs to be higher than Bootstrap's stretched link ::after z-index */
607     }
608   }
609 }
610
611 /* Rules for the browse sidebar */
612
613 #sidebar_content {
614   .browse-section {
615     padding-bottom: $spacer;
616     margin-bottom: $spacer;
617     border-bottom: 1px solid $grey;
618
619     h4:first-child {
620       word-wrap: break-word;
621     }
622   }
623
624   .browse-section:last-of-type {
625     border-bottom: none;
626   }
627
628   .browse-tag-list {
629     table-layout: fixed;
630     white-space: pre-wrap;
631     word-wrap: break-word;
632     word-break: break-word;
633
634     tr:last-child th, tr:last-child td {
635       border-bottom: 0;
636     }
637   }
638
639   .query-results {
640     display: none;
641   }
642 }
643
644 /* Force LTR/RTL alignment for placeholder text */
645
646 .form-control::placeholder {
647   text-align: left;
648 }
649
650 /* Rules for export sidebar */
651
652 .export_form {
653   .export_area_inputs {
654     input[type="text"] {
655       width: 100px;
656     }
657   }
658
659   .export_boxy {
660     > * {
661         margin: -1px;
662     }
663   }
664 }
665
666 /* Rules for edit pages */
667
668 .site-edit {
669   #content {
670     position: absolute;
671     top: $headerHeight;
672     bottom: 0;
673     width: 100%;
674   }
675 }
676
677 /* Rules for non-map content pages */
678
679 .content-inner {
680   max-width: 960px;
681   padding: $lineheight;
682 }
683
684 /* Rules for login and signup pages */
685
686 .sessions-new, .users-new, .users-create {
687   #content .content-inner {
688     max-width: 760px;
689   }
690 }
691
692 .header-illustration {
693   background-position: right;
694   background-repeat: no-repeat;
695   position: relative;
696   min-height: 200px;
697   width: 100%;
698   left: 0;
699   bottom: 0;
700
701   &.new-user-main {
702     background-image: image-url("sign-up-illustration.svg");
703     background-position-x: 70px;
704   }
705
706   &.confirm-main {
707     background-image: image-url("confirm-illustration.svg");
708   }
709
710   &.new-user-terms {
711     background-image: image-url("terms-illustration.svg");
712   }
713 }
714
715 [dir=rtl] .header-illustration {
716   transform: scaleX(-1);
717
718   h1 {
719     transform: scaleX(-1);
720   }
721
722   ul {
723     transform: scaleX(-1);
724   }
725 }
726
727 /* Rules for small maps in content areas */
728
729 .content_map {
730   height: 200px;
731   margin-bottom: $lineheight;
732 }
733
734 @include media-breakpoint-up(md) {
735   .content_map {
736     height: 400px;
737   }
738 }
739
740 /* Rules for the user map */
741
742 .content_map .leaflet-popup-content {
743   margin: $spacer;
744   min-height: 50px;
745 }
746
747 /* Rules for user popups on maps */
748
749 .user_popup {
750   p {
751     padding: 0 0 5px 0;
752     margin: 0 0 0 60px;
753     font-size: 12px;
754   }
755 }
756
757 /* Rules for the diary entry page */
758
759 .diary_entries {
760   #map {
761     height: 400px;
762     display: none;
763   }
764   .diary-comment .col-auto {
765     width: 62px;
766   }
767   .diary-comment .col {
768     max-width: 690px;
769   }
770 }
771
772 /* Rules for the issues page */
773
774 .issues.issues-index {
775   td.reporting_users {
776     max-width: 5rem;
777   }
778 }
779
780 /* Rules for the account confirmation page */
781
782 .accounts-terms-show {
783   .legale {
784     padding: $lineheight;
785     margin-bottom: $lineheight;
786     overflow: auto;
787     height: 20em;
788
789     li {
790       list-style: inherit;
791     }
792
793     ol ol {
794       list-style-type: lower-alpha;
795     }
796   }
797 }
798
799 /* Rules for user images */
800
801 img.user_image {
802   max-width: 100px;
803   max-height: 100px;
804 }
805
806 img.user_thumbnail {
807   max-width: 50px;
808   max-height: 50px;
809 }
810
811 img.user_thumbnail_tiny {
812   width: 25px;
813   height: 25px;
814   object-fit: contain;
815 }
816
817 /* General styles for action lists / subnavs */
818
819 nav.secondary-actions {
820   margin-left: -11px;
821   overflow: hidden;
822   > ul {
823     display: flex;
824     flex-direction: row;
825     flex-wrap: wrap;
826     margin-bottom: 0;
827     margin-left: -1px;
828     padding: 0;
829     > li {
830       flex-basis: auto;
831       list-style: none;
832       border-left: 1px solid $grey;
833       padding-left: $lineheight * 0.5;
834       margin-right: $lineheight * 0.5;
835       margin-bottom: $lineheight * 0.125;
836     }
837   }
838 }
839
840 div.secondary-actions {
841   padding: 10px;
842   text-align: center;
843 }
844
845 /* Rules for rich text */
846
847 .richtext {
848   code {
849     background: var(--bs-secondary-bg);
850     padding: 2px 3px;
851   }
852
853   pre {
854     background: var(--bs-secondary-bg);
855     padding: 2px 3px;
856     white-space: pre-wrap;
857
858     code {
859       padding: 0;
860     }
861   }
862
863   img {
864     padding: $lineheight;
865     background-color: var(--bs-tertiary-bg);
866     display: block;
867     max-width: 100%;
868     margin: auto;
869   }
870
871   blockquote {
872     border-left: $lineheight solid var(--bs-tertiary-bg);
873     padding-left: $lineheight;
874     margin: 0;
875     color: var(--bs-secondary-color);
876   }
877 }
878
879 /* Rules for the "About" page */
880
881 .site-about #content {
882   .content-inner {
883     max-width: 760px;
884   }
885
886   .attr {
887     margin-top: -20px;
888
889     h1 {
890       span {
891         color: $vibrant-green;
892       }
893     }
894
895     .user-image {
896       height: 150px;
897       background-position: 0 50%;
898       background-repeat: no-repeat;
899       background-image: image-url('about/osm.png');
900       background-size: cover;
901       background-color: $vibrant-green;
902     }
903
904     .byosm {
905       background: $vibrant-green;
906     }
907
908     .byosm span {
909       display: inline-block;
910       width: 1em;
911       margin-left: -1em;
912     }
913   }
914 }
915
916 /* Rules for tables with usernames */
917
918 .messages-table .username,
919 #block_list .username {
920   max-width: 20em;
921 }
922
923 /* Rules for navigation tabs */
924
925 .nav-tabs .username {
926   max-width: 20em;
927 }
928
929 .bg-body-secondary .nav-tabs {
930   --bs-border-color: var(--bs-secondary-border-subtle);
931   --bs-secondary-bg: var(--bs-secondary-border-subtle);
932   margin-bottom: -1px;
933 }
934
935 /* Rules for traces */
936
937 img.trace_image {
938   mix-blend-mode: darken;
939 }
940
941 @include color-mode(dark) {
942   img.trace_image {
943     filter: invert(1);
944     mix-blend-mode: lighten;
945   }
946 }
947
948 /* Rules for map sidebar icons */
949
950 .browse-section .browse-element-list {
951   line-height: 1.25rem;
952
953   .browse-icon {
954     height: 1.25rem;
955   }
956
957   .d-flex > .browse-icon {
958     height: max(20px, 1.25rem);
959   }
960
961   @include color-mode(dark) {
962     .browse-icon-invertible {
963       filter: invert(.8) hue-rotate(180deg);
964     }
965   }
966 }
967
968 .heatmap-wrapper {
969   height: 130px;
970 }