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