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