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