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