Refactor layout and add sections

This commit is contained in:
gribse 2025-04-27 00:06:51 +02:00
parent 4bb821bc73
commit 286519acab
2 changed files with 202 additions and 97 deletions

View file

@ -19,66 +19,117 @@
<link rel="stylesheet" href="{{ $core.RelPermalink }}">
<style>
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center; /* Center the main-screen horizontally */
align-items: stretch; /* Ensure full height */
min-height: 100vh; /* Ensure the body takes up the full viewport height */
}
.main-screen {
display: flex;
flex-direction: row;
justify-content: space-between; /* Ensure side-screens are adjacent to main-content */
width: auto; /* Allow the width to adjust based on content */
max-width: 100%; /* Prevent overflow */
gap: 0;
text-align: justify;
}
.side-screen {
height: 100vh;
overflow-y: auto; /* Allow scrolling if content overflows */
flex: 0 0 400px; /* Fixed width of 400px */
}
.main-content {
flex-grow: 1; /* Take up the remaining space between side-screens */
max-width: 750px; /* Optional: Limit max width */
margin: 0 25px;
}
.site-title {
width: 100%;
text-align: center;
}
.icon-row {
display: flex;
flex-direction: row;
justify-content: center;
width: 100%;
gap: 2rem;
}
.icon-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}
@media (max-width: 1380px) {
.side-screen {
display: none; /* Hide side-screens on smaller screens */
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center; /* Center the main-screen horizontally */
align-items: stretch; /* Ensure full height */
min-height: 100vh; /* Ensure the body takes up the full viewport height */
}
.main-screen {
justify-content: center; /* Center main-content when side-screens are hidden */
display: flex;
flex-direction: row;
justify-content: space-between; /* Ensure side-screens are adjacent to main-content */
width: auto; /* Allow the width to adjust based on content */
max-width: 100%; /* Prevent overflow */
gap: 0;
text-align: justify;
}
}
.side-screen {
height: 100vh;
overflow-y: auto; /* Allow scrolling if content overflows */
flex: 0 0 400px; /* Fixed width of 400px */
}
.main-content {
display: flex;
flex-direction: column;
flex-grow: 1; /* Take up the remaining space between side-screens */
max-width: 900px; /* Optional: Limit max width */
margin: 0 25px;
}
.header {
display: flex;
justify-content: space-between; /* Space between the title and navigation */
align-items: center; /* Align items vertically in the center */
padding: 10px 20px; /* Optional: Add some padding */
}
.site-title {
flex-grow: 1;
margin: 0; /* Remove default margin */
font-size: 3rem; /* Adjust font size as needed */
}
.navigation {
flex-grow: 3;
display: flex;
}
.navigation ul {
display: flex;
flex-wrap: wrap; /* Allow items to wrap onto multiple lines */
list-style: none;
margin: 0; /* Remove default margin */
padding: 0; /* Remove default padding */
justify-content: flex-end; /* Align items to the right */
}
.navigation ul li {
margin: 0 10px 0 10px;
}
.navigation ul li a:hover {
text-decoration: underline; /* Add underline on hover */
}
.center-content {
display: flex;
flex-grow: 1; /* Allow it to grow */
gap: 20px; /* Optional: Add spacing between child elements */
}
.presentation, .side-content-column {
flex: 1; /* Make both elements take up equal width */
}
.presentation {
max-width: 100%; /* Ensure it doesn't exceed its container */
}
.side-content-column {
max-width: 100%; /* Ensure it doesn't exceed its container */
}
@media (max-width: 1380px) {
.side-screen {
display: none; /* Hide side-screens on smaller screens */
}
.main-screen {
justify-content: center; /* Center main-content when side-screens are hidden */
}
}
/* Media query for when main-content is less than 700px wide */
@media (max-width: 700px) {
.center-content, .header{
flex-direction: column; /* Stack elements vertically */
}
.presentation, .side-content-column, .site-title, .navigation{
flex: none; /* Reset flex property */
width: 100%; /* Make them take full width */
}
}
</style>
</head>
@ -137,51 +188,86 @@
{{ partial "posts-defile.html" (dict "context" . "direction" "up") }}
</div>
<div class="main-content">
<h1 class="site-title">{{ .Title }}</h1>
<div class="header">
{{- if (not site.Params.disableThemeToggle) }}
<button id="theme-toggle" accesskey="t" title="(Alt + T)" aria-label="Toggle theme">
<svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
<svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</button>
{{- end }}
<h1 class="site-title">Achille Toupin</h1>
<nav class="navigation">
<ul>
<li>📝 <a href="blog">Blog</a></li>
<p> · </p>
<li>📠 <a href="collection">Machines</a></li>
<p> · </p>
<li>🔗 <a href="liens">Liens</a></li>
<p> · </p>
<li>🔖 <a href="liens">Marque-pages</a></li>
<p> · </p>
<li>🌐 <a href="blogroll">Blogroll</a></li>
<p> · </p>
<li><a href="blogroll">A propos</a></li>
<p> · </p>
<li>✉️ <a href="contact">Contact</a></li>
</ul>
{{- if (not site.Params.disableThemeToggle) }}
<button id="theme-toggle" accesskey="t" title="(Alt + T)" aria-label="Toggle theme">
<svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"
stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
<svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</button>
{{- end }}
</nav>
{{ .Content }}
<div class="icon-row">
<a class="icon-item" href="/blog">
<img src="/icon_work.webp" alt="Work icon by Shar"></img>
<span>Blog</span>
</a>
<a class="icon-item" href="/collection">
<img src="/icon_work.webp" alt="Work icon by Shar"></img>
<span>Collection</span>
</a>
<a class="icon-item" href="/recettes">
<img src="/icon_work.webp" alt="Work icon by Shar"></img>
<span>Recettes</span>
</a>
<a class="icon-item" href="/livres">
<img src="/icon_work.webp" alt="Work icon by Shar"></img>
<span>Livres</span>
</a>
</div>
<div class="center-content">
<div class="presentation">
{{ .Content }}
</div>
<div class="side-content-column">
<div class="dernier-article">
<h2>Mon dernier article</h2>
{{ partial "posts-recents-carte.html" . }}
</div>
<div class="dernier-article">
<h2>Mon dernier article</h2>
{{ partial "posts-recents-carte.html" . }}
</div>
</div>
</div>
{{ partial "buttons.html"}}
{{ partialCached "footer.html" . .Layout .Kind (.Param "hideFooter") (.Param "ShowCodeCopyButtons") -}}
</div>
<div class="side-screen">
{{ partial "posts-defile.html" (dict "context" . "direction" "down") }}