Update CSS according personal website

This commit is contained in:
Knah Tsaeb 2024-12-31 12:17:43 +01:00
parent 854d3ccd2f
commit 3745cf1f03
3 changed files with 109 additions and 82 deletions

View file

@ -67,7 +67,8 @@ class FileAndDir {
*/ */
public function makeBreadcrumb(): string { public function makeBreadcrumb(): string {
if ($this->requestedDir !== '' && $this->requestedDir !== 'photos') { if ($this->requestedDir !== '' && $this->requestedDir !== 'photos') {
$breadcrumb_navigation = '<a href="?dir=">Home</a> > '; $breadcrumb_navigation = '<ul>
<li><a href="?dir=">Home</a></li>';
$navitems = explode("/", htmlspecialchars($this->requestedDir)); $navitems = explode("/", htmlspecialchars($this->requestedDir));
$path = ''; $path = '';
@ -78,13 +79,13 @@ class FileAndDir {
$path .= $item; $path .= $item;
if ($index === count($navitems) - 1) { if ($index === count($navitems) - 1) {
$breadcrumb_navigation .= htmlspecialchars($item); $breadcrumb_navigation .= '<li>'.htmlspecialchars($item).'</li>';
} else { } else {
$breadcrumb_navigation .= '<a href="?dir=/' . htmlspecialchars($path) . '">' . htmlspecialchars($item) . '</a> > '; $breadcrumb_navigation .= '<li><a href="?dir=/' . htmlspecialchars($path) . '">' . htmlspecialchars($item) . '</a></li>';
$path .= '/'; $path .= '/';
} }
} }
return $breadcrumb_navigation; return $breadcrumb_navigation.'</ul>';
} else { } else {
return ''; return '';
} }

View file

@ -1,13 +1,3 @@
[data-theme="dark"] {
--background-color: #171414;
--text-color: #fffbfb;
}
[data-theme="light"] {
--background-color: #fffbfb;
--text-color: #171414;
}
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
@ -17,11 +7,8 @@ html {
} }
body { body {
background: var(--background-color);
color: var(--text-color);
width: 80vw; width: 80vw;
margin: 0 auto; margin: 0 auto;
min-height: 100vh;
min-height: 100dvh; min-height: 100dvh;
text-rendering: optimizeSpeed; text-rendering: optimizeSpeed;
font-size: var(--font-size); font-size: var(--font-size);
@ -29,6 +16,8 @@ body {
} }
header { header {
background-color: transparent;
h1 { h1 {
font-size: calc(var(--font-size) * 1.6); font-size: calc(var(--font-size) * 1.6);
margin: 0; margin: 0;
@ -37,6 +26,7 @@ header {
h1 a { h1 a {
color: var(--primary); color: var(--primary);
text-decoration: underline transparent; text-decoration: underline transparent;
text-decoration-thickness: var(--default-space);
transition: 0.4s; transition: 0.4s;
} }
@ -45,25 +35,59 @@ header {
text-decoration: underline var(--primary); text-decoration: underline var(--primary);
text-decoration-thickness: var(--default-space); text-decoration-thickness: var(--default-space);
} }
}
nav { nav {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
padding: 0;
}
ul { nav ul {
font-size: calc(var(--font-size) * 1.2); display: flex;
} gap: calc(var(--default-space) * 2);
flex-wrap: wrap;
padding: 0;
margin: 0;
a {
color: var(--primary-lighten);
font-weight: normal;
padding: 0;
} }
} }
/**/ nav li {
margin: var(--default-space);
list-style: none;
font-size: calc(var(--font-size) * 1.2);
}
.breadcrumb {
li {
margin: auto 0;
}
& li:not(:last-child)::after {
content: " > ";
}
ul {
gap: 0;
}
}
#toggleDarkMode { #toggleDarkMode {
fill: var(--primary); fill: var(--primary);
height: calc(var(--font-size) * 1.6); height: var(--font-size);
transition: 0.4s;
}
#toggleDarkMode:hover {
fill: var(--primary-lighten);
} }
a { a {
@ -71,6 +95,7 @@ a {
font-weight: bold; font-weight: bold;
text-decoration: none; text-decoration: none;
text-decoration: underline transparent; text-decoration: underline transparent;
text-decoration-thickness: var(--default-space);
transition: 0.4s; transition: 0.4s;
} }
@ -96,13 +121,6 @@ a:not(.card-content):hover {
stroke: #000 !important; stroke: #000 !important;
} }
body>header {
background-color: transparent;
color: var(--header-text-color);
padding: 0 .5em;
}
.breadcrumb,
aside { aside {
color: var(--light-text-color); color: var(--light-text-color);
background-color: var(--light-background-color); background-color: var(--light-background-color);
@ -151,11 +169,18 @@ aside * {
margin: .2em 0; margin: .2em 0;
} }
main { section {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: .5em; justify-content: space-around;
justify-content: center; gap: var(--default-space);
color: var(--light-text-color);
background-color: var(--light-background-color);
padding: calc(var(--default-space) * 2);
border: 1px solid var(--background-color-darken);
border-radius: calc(var(--default-space) * 1.2);
margin: calc(var(--default-space) *5) 0;
box-shadow: var(--box-shadow-light);
} }
article { article {

View file

@ -39,8 +39,8 @@ use App\FileAndDir;
<?= $userCss; ?> <?= $userCss; ?>
</head> </head>
<body> <body id="top">
<header id="top"> <header>
<nav> <nav>
<h1> <h1>
<svg class="logo" viewBox="0 0 135.467 135.467" xmlns="http://www.w3.org/2000/svg"> <svg class="logo" viewBox="0 0 135.467 135.467" xmlns="http://www.w3.org/2000/svg">
@ -65,7 +65,7 @@ use App\FileAndDir;
</h1> </h1>
<ul> <ul>
<li><a href="">Site</a></li> <li><a href="<?= $config['website']; ?>">Site</a></li>
</ul> </ul>
<ul> <ul>
<li><a href="#" onclick="switchTheme();"><svg version="1.1" id="toggleDarkMode" viewBox="0 0 512 512"> <li><a href="#" onclick="switchTheme();"><svg version="1.1" id="toggleDarkMode" viewBox="0 0 512 512">
@ -81,7 +81,7 @@ use App\FileAndDir;
</ul> </ul>
</nav> </nav>
</header> </header>
<main>
<section> <section>
<?php if ($breadcrumb_navigation): ?> <?php if ($breadcrumb_navigation): ?>
<nav aria-label="breadcrumb" class="breadcrumb"> <nav aria-label="breadcrumb" class="breadcrumb">
@ -101,7 +101,7 @@ use App\FileAndDir;
<?php endif; ?> <?php endif; ?>
</section> </section>
<main> <section>
<?php foreach ($listDir as $value) : ?> <?php foreach ($listDir as $value) : ?>
<?php foreach ($value as $entry) : ?> <?php foreach ($value as $entry) : ?>
<article> <article>
@ -115,6 +115,7 @@ use App\FileAndDir;
</article> </article>
<?php endforeach; ?> <?php endforeach; ?>
<?php endforeach; ?> <?php endforeach; ?>
</section>
</main> </main>
<a href="#top" id="backtop">Top</a> <a href="#top" id="backtop">Top</a>