Skip to content

Commit 8415fc8

Browse files
Mpdreamzreakaleek
andauthored
feature/limited width layout 4 (#1201)
* fixate max-width around max content-width * npm fix lint * Update src/Elastic.Markdown/Slices/_Layout.cshtml Co-authored-by: Jan Calanog <[email protected]> --------- Co-authored-by: Jan Calanog <[email protected]>
1 parent ccd8171 commit 8415fc8

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

src/Elastic.Markdown/Assets/styles.css

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@
2424
--banner-height: calc(var(--spacing) * 9);
2525
/*--offset-top: calc(var(--header-height) + var(--banner-height));*/
2626
--offset-top: 72px;
27-
--max-layout-width: 1500px;
27+
--max-text-width: clamp(40ch, 90ch, 100%);
2828
--max-sidebar-width: calc(var(--spacing) * 65);
29-
--max-content-width: calc(
30-
var(--max-layout-width) - (var(--max-sidebar-width) * 2)
29+
--content-spacing: calc(var(--spacing) * 8);
30+
--max-layout-width: calc(
31+
var(--max-text-width) + (var(--max-sidebar-width) * 2) +
32+
calc(var(--content-spacing) * 2)
3133
);
3234
}
3335

@@ -234,7 +236,11 @@
234236

235237
.container {
236238
@apply lg:px-3;
237-
max-width: 1250px !important;
239+
max-width: var(--max-layout-width) !important;
240+
241+
* {
242+
@apply font-body;
243+
}
238244
}
239245

240246
#elastic-nav {

src/Elastic.Markdown/Slices/Layout/_Footer.cshtml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
@inherits RazorSlice<LayoutViewModel>
22

33

4-
<footer class="text-grey-20 text-[12px] bg-ink-dark py-12 px-6">
4+
<footer class="py-12 px-6 w-full mx-auto bg-ink-dark">
55
<div class="max-w-(--max-layout-width) w-full mx-auto">
6+
<div class="text-grey-20 text-[12px]">
67
<a href="https://www.elastic.co/">
78
<img class="block" alt="Elastic logo" src="@Model.Static("logo-elastic-horizontal-white.svg")" width="120"/>
89
</a>
910
</div>
10-
<div class="max-w-(--max-layout-width) w-full mx-auto grid grid-cols-1 md:grid-cols-2 gap-2 rounded-tl-4xl rounded-tr-4xl items-center">
11+
<div class="text-grey-20 text-[12px] bg-ink-dark grid grid-cols-1 md:grid-cols-2 gap-2 items-center">
1112
<div>
1213
<ul class="mt-4 flex gap-3">
1314
<li>
@@ -31,6 +32,7 @@
3132
Elasticsearch is a trademark of Elasticsearch B.V., registered in the U.S. and in other countries. Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.
3233
</p>
3334
</div>
35+
</div>
3436
</footer>
3537

3638
<script src="@Model.Static("main.js")"></script>

src/Elastic.Markdown/Slices/Layout/_Header.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
}
88
else
99
{
10-
<header class="sticky top-0 z-50 bg-blue-developer text-white text-lg font-semibold h-(--offset-top) flex items-center px-6">
10+
<header class="sticky top-0 z-50 bg-blue-developer text-white h-(--offset-top) flex items-center">
1111
<div class="max-w-(--max-layout-width) w-full mx-auto flex justify-between items-center">
1212
@* ReSharper disable once Html.IdNotResolved *@
1313
<label role="button" class="md:hidden cursor-pointer" for="pages-nav-hamburger">
1414
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-8">
1515
<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25H12"/>
1616
</svg>
1717
</label>
18-
<a href="@Model.Link("/")" class="flex items-center gap-2">
18+
<a href="@Model.Link("/")" class="flex items-center gap-2 text-lg font-semibold px-4">
1919
<img src="@Model.Static("logo-elastic-glyph-color.svg")" alt="" width="32" height="32">
2020
@Model.DocSetName
2121
</a>

src/Elastic.Markdown/Slices/Layout/_LandingPage.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@inherits RazorSlice<LayoutViewModel>
2-
<div class="w-full font-body text-ink relative text-pretty">
2+
<div class="w-full text-ink relative text-pretty">
33
<div class="w-full absolute top-0 left-0 right-0 htmx-indicator" id="htmx-indicator" role="status">
44
<div class="h-[2px] w-full overflow-hidden">
55
<div class="progress w-full h-full bg-pink-70 left-right"></div>

src/Elastic.Markdown/Slices/Layout/_PagesNav.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@inherits RazorSlice<LayoutViewModel>
2-
<aside class="sidebar bg-white fixed md:sticky shadow-2xl md:shadow-none left-[100%] group-has-[#pages-nav-hamburger:checked]/body:left-0 bottom-0 md:left-auto pl-6 md:pl-0 top-[calc(var(--offset-top)+1px)] w-[80%] md:w-auto shrink-0 border-r-1 border-r-grey-20 z-40 md:z-auto">
2+
<aside class="sidebar bg-white fixed md:sticky shadow-2xl md:shadow-none left-[100%] group-has-[#pages-nav-hamburger:checked]/body:left-0 bottom-0 md:left-auto pl-6 md:pl-2 top-[calc(var(--offset-top)+1px)] w-[80%] md:w-auto shrink-0 border-r-1 border-r-grey-20 z-40 md:z-auto">
33
<nav
44
id="pages-nav"
55
class="sidebar-nav h-full"

src/Elastic.Markdown/Slices/_Layout.cshtml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@
2323

2424
private async Task DefaultLayout()
2525
{
26-
<div class="max-w-(--max-layout-width) w-full h-full grid px-6
26+
<div class="max-w-(--max-layout-width) w-full h-full grid
2727
grid-cols-1
2828
md:grid-cols-[var(--max-sidebar-width)_1fr]
2929
lg:grid-cols-[var(--max-sidebar-width)_1fr_var(--max-sidebar-width)]
3030
">
3131
@await RenderPartialAsync(_PagesNav.Create(Model))
32-
<div class="justify-center px-6 grid
32+
<div class="justify-center grid
3333
grid-cols-1
34-
lg:grid-cols-[1fr_clamp(40ch,80ch,100%)_1fr]
34+
px-6 lg:px-0
35+
lg:grid-cols-[1fr_var(--max-text-width)_1fr]
3536
">
3637
<div class="spacer"></div>
3738
<main id="content-container" class="w-full flex flex-col relative pb-30 overflow-x-hidden">

0 commit comments

Comments
 (0)