backend: rework and simplify styles

This commit is contained in:
Lucas 2023-03-14 21:53:34 +00:00
parent 4571ab3643
commit 6e11d9d00f
3 changed files with 58 additions and 48 deletions

View File

@ -17,10 +17,20 @@
*/ */
:root { :root {
--bg-color: #0c0700; --dark-theme-bg: #0c0700;
--fg-color: #fff8f0; --dark-theme-text: #fff8f0;
--accent-color-0: #ec57bc; --dark-theme-accent: #ec57bc;
--accent-color-1: #f7be00; --dark-theme-accent-hover: #f7be00;
--light-theme-bg: #fff8f0;
--light-theme-text: #0c0700;
--light-theme-accent: #dc3a23;
--light-theme-accent-hover: #4997ce;
--bg: var(--dark-theme-bg);
--text: var(--dark-theme-text);
--accent: var(--dark-theme-accent);
--accent-hover: var(--dark-theme-accent-hover);
} }
*, *,
@ -41,15 +51,27 @@ p {
body { body {
margin: 0 auto; margin: 0 auto;
min-height: 100vh; min-height: 100vh;
background-color: var(--bg-color); background-color: var(--bg);
color: var(--fg-color); color: var(--text);
font-family: monospace; font-family: monospace;
font-size: 1.25rem; font-size: 1.25rem;
line-height: 2.4; line-height: 2.4;
} }
main { body > header {
border-bottom: 0.0625rem solid var(--accent);
margin-bottom: 0.1875rem;
}
body > main {
padding-top: 1.5rem; padding-top: 1.5rem;
border-top: 0.0625rem solid var(--accent);
border-bottom: 0.0625rem solid var(--accent);
}
body > footer {
border-top: 0.0625rem solid var(--accent);
margin-top: 0.1875rem;
} }
dl, dl,
@ -74,18 +96,15 @@ h2 {
line-height: 1.2; line-height: 1.2;
} }
a { a,
color: var(--accent-color-0);
}
a:link, a:link,
a:visited { a:visited {
color: var(--accent-color-0); color: var(--accent);
} }
a:hover, a:hover,
a:active { a:active {
color: var(--accent-color-1); color: var(--accent-hover);
} }
dt { dt {
@ -102,16 +121,12 @@ dd {
width: 60rem; width: 60rem;
} }
.border-bottom {
border-bottom: 1px solid;
}
.border-top { .border-top {
border-top: 1px solid; border-top: 0.0625rem solid var(--accent);
} }
.border-accent { .border-bottom {
border-color: var(--accent-color-0); border-bottom: 0.0625rem solid var(--accent);
} }
.text-center { .text-center {
@ -123,27 +138,15 @@ dd {
line-height: 3; line-height: 3;
} }
.bg-color { .main-nav {
background-color: var(--bg-color); gap: 0 1rem;
} }
.fg-color { .main-nav > a {
color: var(--fg-color);
}
.fg-accent {
color: var(--accent-color-0);
}
.main-nav-link {
font-weight: bold; font-weight: bold;
text-decoration: none; text-decoration: none;
} }
.main-nav-link-gap {
gap: 0 1rem;
}
/* 0.5rem padding compensates the unused 1rem gap at the end. */ /* 0.5rem padding compensates the unused 1rem gap at the end. */
.gallery { .gallery {
align-items: center; align-items: center;
@ -151,15 +154,22 @@ dd {
padding: 0 0.5rem; padding: 0 0.5rem;
} }
.gallery-image { .gallery > a > img,
.gallery > a:link > img,
.gallery > a:visited > img {
max-height: 24rem; max-height: 24rem;
max-width: 14rem; max-width: 14rem;
height: 100%; height: 100%;
width: 100%; width: 100%;
outline-offset: 0.1875rem;
outline: 0.0625rem solid;
outline-color: var(--accent);
} }
.media-image { .gallery > a:hover > img,
max-width: 100%; .gallery > a:active > img {
outline-color: var(--accent-hover);
} }
.flex-c-horizontal { .flex-c-horizontal {

View File

@ -3,7 +3,7 @@
<div class="flex-c-horizontal flex-c-wrap gallery"> <div class="flex-c-horizontal flex-c-wrap gallery">
% for my $m (@$media) { % for my $m (@$media) {
<%= link_to $m->{media_src} => begin %> <%= link_to $m->{media_src} => begin %>
<%= image $m->{media_src}, class => "gallery-image" %> <%= image $m->{media_src} %>
<% end %> <% end %>
% } % }
</div> </div>

View File

@ -8,18 +8,18 @@
</head> </head>
<body class="bg-default fg-default flex-c-vertical"> <body class="bg-default fg-default flex-c-vertical">
<header> <header>
<nav class="viewport flex-c-horizontal main-nav-link-gap"> <nav class="viewport flex-c-horizontal main-nav">
<%= link_to "Pooru~" => "/" => (class => "main-nav-link") %> <%= link_to "Pooru~" => "/" %>
<%= link_to "random" => "/random" => (class => "main-nav-link") %> <%= link_to "random" => "/random" %>
<%= link_to "tags" => "/tags" => (class => "main-nav-link") %> <%= link_to "tags" => "/tags" %>
<span class="flex-i-fullsize"><!-- spacer --></span> <span class="flex-i-fullsize"><!-- spacer --></span>
<%= link_to login => "/login" => (class => "main-nav-link") %> <%= link_to login => "/login" %>
</nav> </nav>
</header> </header>
<main class="border-bottom border-top border-accent flex-i-fullsize flex-c-vertical"> <main class="flex-i-fullsize flex-c-vertical">
<div class="viewport flex-i-fullsize flex-c-vertical"> <div class="viewport flex-i-fullsize flex-c-vertical">
<h1><%= title %></h1> <h1><%= title %></h1>
<div class="viewport flex-i-fullsize"><%= content %></div> <div class="flex-i-fullsize"><%= content %></div>
<% if (defined $pager) { %> <% if (defined $pager) { %>
<footer> <footer>
<nav class="text-center"> <nav class="text-center">
@ -33,8 +33,8 @@
<% } %> <% } %>
</div> </div>
</main> </main>
<footer class="text-center"> <footer class="border-top">
<p class="viewport text-small">Powered by <a href="https://www.openbsd.org">OpenBSD</a> and <a href="https://mojolicious.org/">Mojolicious</a></p> <p class="viewport text-center text-small">Powered by <a href="https://www.openbsd.org">OpenBSD</a> and <a href="https://www.perl.org/">Perl</a>.</p>
</footer> </footer>
</body> </body>
</html> </html>