feat: Rewrite nav, improve comment faves/boosts

Also, this is perhaps last featire commit here, I'll merge duckquill and my main site, it can be still used as a theme, it's just will be more convenient
This commit is contained in:
daudix
2024-01-17 18:58:49 +03:00
parent 7fb135c2a9
commit 5d8b14530b
8 changed files with 137 additions and 99 deletions

View File

@ -122,6 +122,7 @@ section#comments {
color: inherit; color: inherit;
grid-area: card; grid-area: card;
max-width: 400px; max-width: 400px;
text-decoration: none;
&:hover { &:hover {
text-decoration: none; text-decoration: none;
@ -155,8 +156,16 @@ section#comments {
padding: 1rem; padding: 1rem;
text-align: left; text-align: left;
h5 {
font-weight: 600;
all: unset;
font-size: 1rem;
}
p { p {
font-weight: 400;
color: var(--fg-muted-5); color: var(--fg-muted-5);
font-size: 0.8rem;
} }
* { * {
@ -177,40 +186,66 @@ section#comments {
} }
footer { footer {
@extend small;
display: flex; display: flex;
gap: 0.4rem; gap: 0.4rem;
grid-area: interactions; grid-area: interactions;
margin-top: 1rem; margin-top: 1rem;
.boosts { .reblogs,
background-color: var(--orange-bg); .favourites {
border-radius: var(--rounded-corner); border-radius: var(--rounded-corner);
color: var(--orange-fg); font-size: 1rem;
cursor: default; font-variant-numeric: tabular-nums;
font-size: 0.9rem; font-weight: 400;
font-weight: 600;
padding: 0.4rem 1rem; padding: 0.4rem 1rem;
text-decoration: none;
transition: var(--transition);
&:hover {
text-decoration: none;
}
&:active {
transform: scale(var(--active));
}
&::before { &::before {
content: "🔁"; -moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: inline-block;
font-family: "bootstrap-icons" !important;
font-style: normal;
font-variant: normal;
font-weight: normal !important;
line-height: 1;
margin-inline-end: 0.25rem; margin-inline-end: 0.25rem;
text-transform: none;
vertical-align: -0.125em;
transform: scale(1);
} }
} }
.faves { .reblogs {
background-color: var(--red-bg); color: var(--orange-fg);
border-radius: var(--rounded-corner);
color: var(--red-fg); &:hover {
cursor: default; background-color: var(--orange-bg);
font-size: 0.9rem; }
font-weight: 600;
padding: 0.4rem 1rem;
&::before { &::before {
content: "❤️"; content: "\F813";
margin-inline-end: 0.25rem; }
}
.favourites {
color: var(--red-fg);
&:hover {
background-color: var(--red-bg);
}
&::before {
content: "\F417";
} }
} }
} }

View File

@ -13,7 +13,7 @@ html {
} }
// Smaller font size on mobile // Smaller font size on mobile
// @media only screen and (max-device-width: 480px) { // @media screen and (max-width: 480px) {
// html { // html {
// font-size: 14px; // font-size: 14px;
// } // }
@ -65,7 +65,7 @@ body {
max-width: var(--content-width); max-width: var(--content-width);
} }
@media only screen and (max-device-width: 480px) { @media screen and (max-width: 480px) {
.container { .container {
width: 90vw; width: 90vw;
} }

View File

@ -16,7 +16,11 @@ img {
box-shadow: var(--shadow-raised); box-shadow: var(--shadow-raised);
} }
@media only screen and (max-device-width: 480px) { &:active {
transform: scale(var(--active));
}
@media screen and (max-width: 480px) {
&:not(.no-hover):hover { &:not(.no-hover):hover {
transform: scale(110%); transform: scale(110%);
} }

View File

@ -1,81 +1,78 @@
.nav { header {
overflow: auto;
width: 80vw;
max-width: calc(var(--content-width) + 10rem);
margin: 1rem auto;
box-shadow: 0px 12px 24px -16px rgba(0, 0, 0, 0.5);
border-radius: var(--rounded-corner-big);
background-color: var(--nav-bg);
backdrop-filter: blur(24px);
-webkit-backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
backdrop-filter: blur(24px);
background-color: var(--nav-bg);
border-radius: 999px;
box-shadow: 0px 12px 24px -16px rgba(0, 0, 0, 0.5);
margin: 1rem auto;
max-width: calc(var(--content-width) + 10rem);
position: sticky; position: sticky;
top: 1rem; top: 1rem;
width: 80vw;
z-index: 1; z-index: 1;
&-container { @media screen and (max-width: 630px) {
margin: 0.5rem 0.5rem; & {
position: relative; border-radius: 16px;
text-align: center;
}
ul {
list-style-type: none;
margin: 1rem 0 0;
padding: 0;
text-align: center;
}
li {
transition: var(--transition);
color: var(--default-color);
display: inline-block;
}
a {
background-color: transparent;
border-radius: var(--rounded-corner);
color: var(--fg-muted-4);
display: inline-block;
font-weight: 400;
padding: 0.4rem 1rem;
text-decoration: none;
transform: scale(1);
transition: var(--transition);
&:hover {
background-color: var(--fg-muted-1);
color: var(--primary-color);
text-decoration: none;
}
&:active {
transform: scale(var(--active));
} }
} }
@media only screen and (max-device-width: 480px) { @media screen and (max-width: 480px) {
& { & {
width: 90vw; width: 90vw;
position: static;
} }
} }
@media (min-width: 600px) { nav {
& { display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
padding: 0.4rem;
@media screen and (max-width: 630px) {
& {
justify-content: center;
}
}
ul {
display: flex;
flex-wrap: wrap;
gap: 0.2rem;
justify-content: center;
margin: 0;
padding: 0;
}
li {
list-style: none;
display: inline-flex;
}
a {
border-radius: 999px; border-radius: 999px;
color: var(--fg-muted-4);
font-weight: 400;
padding: 0.4rem 1rem;
text-decoration: none;
transform: scale(1);
transition: var(--transition);
&-container { @media screen and (max-width: 630px) {
text-align: left; & {
border-radius: var(--rounded-corner);
}
} }
ul { &:hover {
bottom: 0; background-color: var(--fg-muted-1);
position: absolute; color: var(--primary-color);
right: 0; text-decoration: none;
} }
a { &:active {
border-radius: 999px; transform: scale(var(--active));
} }
} }
} }

View File

@ -51,7 +51,6 @@ $glow: 0 0 0 1px color.scale($primary-color, $alpha: -95%),
--drop-shadow: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) --drop-shadow: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07))
drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06)); drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06));
--glow: #{$glow}; --glow: #{$glow};
--rounded-corner-big: 18px;
--rounded-corner-small: 8px; --rounded-corner-small: 8px;
--rounded-corner: 12px; --rounded-corner: 12px;
--shadow-raised: 0 0 0 1px rgba(0, 0, 0, 0.06), --shadow-raised: 0 0 0 1px rgba(0, 0, 0, 0.06),

View File

@ -10,23 +10,24 @@
@use "normalize"; @use "normalize";
@use "variables";
@use "fonts";
@use "main";
@use "bootstrap-icons"; @use "bootstrap-icons";
@use "buttons"; @use "buttons";
@use "comments"; @use "comments";
@use "crt"; @use "crt";
@use "fonts";
@use "footer"; @use "footer";
@use "gnome-hig"; @use "gnome-hig";
@use "johnvertisement"; @use "johnvertisement";
@use "links"; @use "links";
@use "main";
@use "media"; @use "media";
@use "nav"; @use "nav";
@use "not-found"; @use "not-found";
@use "post-nav"; @use "post-nav";
@use "statements"; @use "statements";
@use "tags"; @use "tags";
@use "variables";
@import url("syntax-theme-dark.css") (prefers-color-scheme: dark); @import url("syntax-theme-dark.css") (prefers-color-scheme: dark);
@import url("syntax-theme-light.css") (prefers-color-scheme: light); @import url("syntax-theme-light.css") (prefers-color-scheme: light);

View File

@ -211,21 +211,23 @@ which were inspired by https://codeberg.org/jwildeboer/jwildeboersource/src/comm
let interactions = document.createElement("footer"); let interactions = document.createElement("footer");
if(status.reblogs_count > 0) { if(status.reblogs_count > 0) {
let boosts = document.createElement("span"); let reblogs = document.createElement("a");
boosts.className = "boosts"; reblogs.setAttribute("href", status.url + "/reblogs");
boosts.setAttribute("title", "Boosts"); reblogs.className = "reblogs";
boosts.textContent = status.reblogs_count; reblogs.setAttribute("title", "Boosts");
reblogs.textContent = status.reblogs_count;
interactions.appendChild(boosts); interactions.appendChild(reblogs);
} }
if(status.favourites_count > 0) { if(status.favourites_count > 0) {
let faves = document.createElement("span"); let favourites = document.createElement("a");
faves.className = "faves"; favourites.setAttribute("href", status.url + "/favourites");
faves.setAttribute("title", "Favorites"); favourites.className = "favourites";
faves.textContent = status.favourites_count; favourites.setAttribute("title", "Favorites");
favourites.textContent = status.favourites_count;
interactions.appendChild(faves); interactions.appendChild(favourites);
} }
let comment = document.createElement("article"); let comment = document.createElement("article");

View File

@ -1,5 +1,5 @@
<nav class="nav"> <header>
<div class="nav-container"> <nav>
<a href="{{ get_url(path='') }}"> <a href="{{ get_url(path='') }}">
{% if config.extra.nav.icons %} {% if config.extra.nav.icons %}
<i class="bi bi-house"></i> <i class="bi bi-house"></i>
@ -29,5 +29,5 @@
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
</div> </nav>
</nav> </header>