@@ -263,28 +263,52 @@ body {
263
263
}
264
264
265
265
body {
266
- margin-left : calc (10vw + 20ex );
267
- margin-right : 4ex ;
268
- margin-top : 30px ;
269
- margin-bottom : 50px ;
266
+ margin-left : auto;
267
+ margin-right : auto;
268
+ padding : 0 4ex ;
270
269
}
271
270
272
271
body .odoc {
273
- max-width : 100ex ;
272
+ max-width : 132ex ;
273
+ display : grid;
274
+ grid-template-columns : min-content 1fr ;
275
+ column-gap : 4ex ;
276
+ row-gap : 2ex ;
274
277
}
275
278
276
279
body .odoc-src {
277
280
margin-right : calc (10vw + 20ex );
278
281
}
279
282
283
+ .odoc-content {
284
+ grid-row : 4 ;
285
+ grid-column : 2 ;
286
+ }
287
+
288
+ .odoc-preamble > * : first-child {
289
+ /* This make the first thing in the preamble align with the sidebar */
290
+ padding-top : 0 ;
291
+ margin-top : 0 ;
292
+ }
293
+
280
294
header {
281
295
margin-bottom : 30px ;
282
296
}
283
297
298
+ header .odoc-preamble {
299
+ grid-column : 2 ;
300
+ grid-row : 3 ;
301
+ }
302
+
284
303
nav {
285
304
font-family : "Fira Sans" , sans-serif;
286
305
}
287
306
307
+ nav .odoc-nav {
308
+ grid-column : 2 ;
309
+ grid-row : 2 ;
310
+ }
311
+
288
312
/* Basic markup elements */
289
313
290
314
b , strong {
480
504
font-size : 1.12em ;
481
505
}
482
506
483
- /* Comment delimiters, hidden but accessible to screen readers and
507
+ /* Comment delimiters, hidden but accessible to screen readers and
484
508
selected for copy/pasting */
485
509
486
510
/* Taken from bootstrap */
@@ -759,19 +783,32 @@ td.def-doc *:first-child {
759
783
line-height : 1.2 ;
760
784
}
761
785
786
+ /* When a search bar is present, we need the sticky sidebar to be a bit lower,
787
+ so `top` is higher */
788
+
789
+ .odoc-search + * + .odoc-toc {
790
+ --toc-top : calc (var (--search-bar-height ) + var (--search-padding-top ) + 20px );
791
+ max-height : calc (100vh - 2 * var (--toc-top ));
792
+ top : var (--toc-top )
793
+ }
794
+
762
795
.odoc-toc {
763
- position : fixed;
764
- top : 0px ;
765
- bottom : 0px ;
766
- left : 0px ;
767
- max-width : 30ex ;
768
- min-width : 26ex ;
769
- width : 20% ;
796
+ --toc-top : 20px ;
797
+ width : 28ex ;
770
798
background : var (--toc-background );
771
799
overflow : auto;
772
800
color : var (--toc-color );
773
801
padding-left : 2ex ;
774
802
padding-right : 2ex ;
803
+ grid-row-start : 3 ;
804
+ grid-row-end : 5 ;
805
+ grid-column : 1 ;
806
+ height : fit-content;
807
+ border : solid 1px var (--border );
808
+ border-radius : 5px ;
809
+ position : sticky;
810
+ max-height : calc (100vh - 2 * var (--toc-top ));
811
+ top : var (--toc-top )
775
812
}
776
813
777
814
.odoc-toc ul li a {
@@ -789,26 +826,31 @@ td.def-doc *:first-child {
789
826
}
790
827
791
828
: root {
792
- --search-bar-height : 20px ;
829
+ --search-bar-height : 25px ;
830
+ --search-padding-top : 1rem ;
793
831
}
794
832
795
833
.odoc-search {
796
- --padding-top : 1rem ;
797
834
position : sticky;
798
835
top : 0 ;
799
836
background : var (--main-background );
800
- height : calc (var (--search-bar-height ) + var (--padding-top ));
837
+ /* This amounts to fit-content when the search is not active, but when you
838
+ have the search results displayed, you do not want the height of the search
839
+ container to change. */
840
+ height : calc (var (--search-bar-height ) + var (--search-padding-top ));
801
841
width : 100% ;
802
- padding-top : var (--padding-top );
842
+ padding-top : var (--search- padding-top );
803
843
z-index : 1 ;
844
+ grid-row : 1 ;
845
+ grid-column-start : 1 ;
846
+ grid-column-end : 3 ;
804
847
}
805
848
806
849
807
850
.odoc-search .search-inner {
808
851
width : 100% ;
809
852
position : relative;
810
853
left : 0 ;
811
- transition : left 0.3s , transform 0.3s , width 0.3s ;
812
854
display : grid;
813
855
/* The second column is for the search snake, which has 0 width */
814
856
grid-template-columns : 1fr 0fr ;
@@ -818,20 +860,13 @@ td.def-doc *:first-child {
818
860
background : transparent;
819
861
}
820
862
821
- .odoc-search : focus-within .search-inner {
822
- /* Search inner is bigger than its parent, but the overflow needs to be
823
- centered. */
824
- left : 50% ;
825
- transform : translateX (-50% );
826
- width : 110% ;
827
- }
828
-
829
863
.odoc-search .search-bar {
830
864
position : relative;
831
865
z-index : 2 ;
832
866
font-size : 1em ;
833
867
transition : font-size 0.3s ;
834
868
box-shadow : 0px 0px 0.2rem 0.3em var (--main-background );
869
+ height : var (--search-bar-height );
835
870
}
836
871
837
872
.odoc-search : focus-within .search-bar {
@@ -934,7 +969,7 @@ td.def-doc *:first-child {
934
969
.odoc-search .search-entry {
935
970
color : var (--color );
936
971
display : grid;
937
- /* Possible kinds are the following :
972
+ /* Possible kinds are the following :
938
973
"doc" "type" "mod" "exn" "class" "meth" "cons" "sig" "cons" "field" "val"
939
974
and "ext".
940
975
As the longest is 5 characters (and the font monospace), we give 5
@@ -1113,6 +1148,11 @@ td.def-doc *:first-child {
1113
1148
@media only screen and (max-width : 110ex ) {
1114
1149
body {
1115
1150
margin : 2em ;
1151
+ padding : 0 ;
1152
+ }
1153
+
1154
+ body .odoc {
1155
+ display : block;
1116
1156
}
1117
1157
1118
1158
.odoc-toc {
0 commit comments