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