Skip to content

Commit

Permalink
various styling enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
Reed Nelson committed Aug 11, 2023
1 parent 64d08f4 commit 8d03a92
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/layouts/BlogSingle.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import similerItems from "@/lib/utils/similarItems";
import { humanize, markdownify, slugify } from "@/lib/utils/textConverter";
import { Image } from "@astrojs/image/components";
import {
FaRegClock,
FaRegCalendarAlt,
FaRegFolder,
FaRegUserCircle,
} from "react-icons/fa/index.js";
Expand Down Expand Up @@ -46,7 +46,7 @@ const { title, description, author, categories, image, date, tags } = post.data;
{humanize(author)}
</li>
<li class="mr-4 inline-block">
<FaRegClock className={"mr-2 -mt-1 inline-block"} />
<FaRegCalendarAlt className={"mr-2 -mt-1 inline-block"} />
{dateFormat(date)}
</li>
<li class="mr-4 inline-block">
Expand Down
13 changes: 9 additions & 4 deletions src/layouts/components/BlogCard.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import config from "@/config/config.json";
import { humanize, plainify, slugify } from "@/lib/utils/textConverter";
import { Image } from "@astrojs/image/components";
import { FaRegFolder, FaRegUserCircle } from "react-icons/fa/index.js";
import { FaRegFolder, FaRegUserCircle, FaRegClock } from "react-icons/fa/index.js";
import readingTime from "@/lib/utils/readingTime";
const {
summary_length,
Expand Down Expand Up @@ -31,14 +32,14 @@ const { title, image, date, author, categories } = data.data;
</a>
</h4>
<ul class="mb-4">
<li class="mr-4 inline-block">
<!-- <li class="mr-4 inline-block">
<a href={`/authors/${slugify(author)}`}>
<FaRegUserCircle className={"mr-2 -mt-1 inline-block"} />
{humanize(author)}
</a>
</li>
</li> -->
<li class="mr-4 inline-block">
<FaRegFolder className={"mr-2 -mt-1 inline-block"} />
<FaRegFolder className={"mr-1 -mt-1 inline-block"} />
{
categories.map((category: string, index: number) => (
<a href={`/blog/categories/${slugify(category)}`}>
Expand All @@ -48,6 +49,10 @@ const { title, image, date, author, categories } = data.data;
))
}
</li>
<li class="mr-4 inline-block ">
<FaRegClock className={"mr-1 -mt-1 inline-block"} />
{readingTime(data.body)}
</li>
</ul>
<p class="mb-6">{plainify(data.body?.slice(0, Number(summary_length)))}</p>
<a
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/components/ThemeSwitcher.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { className }: { className?: string } = Astro.props;

{
theme_switcher && (
<div class={`theme-switcher ${className}`}>
<div class={`theme-switcher a ${className}`}>
<input id="theme-switcher" data-theme-switcher type="checkbox" />
<label for="theme-switcher">
<span class="sr-only">theme switcher</span>
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/partials/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const { pathname } = Astro.url;
{
settings.search && (
<a
class="mr-5 inline-block border-r border-border pr-5 text-xl text-dark hover:text-primary dark:border-darkmode-border dark:text-white"
class="mr-5 inline-block border-border text-xl text-dark hover:text-primary dark:border-darkmode-border dark:text-white"
href="/search"
aria-label="search"
>
Expand Down
12 changes: 4 additions & 8 deletions src/lib/utils/readingTime.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// content reading
const readingTime = (content: string): string => {
const WPS = 275 / 60;
const WPS = 225 / 60;

let images = 0;
const regex = /\w/;
Expand All @@ -26,14 +26,10 @@ const readingTime = (content: string): string => {

const minutes = Math.ceil(((words - imageAdjust) / WPS + imageSecs) / 60);

if (minutes < 10) {
if (minutes < 2) {
return "0" + minutes + ` Min read`;
} else {
return "0" + minutes + ` Mins read`;
}
if (minutes < 2) {
return minutes + ` minute`;
} else {
return minutes + ` Mins read`;
return minutes + ` minutes`;
}
};

Expand Down
6 changes: 3 additions & 3 deletions src/pages/about.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ const { title, description, meta_title, image } = about.data;
{
image && (
<Image
class="mx-auto mb-6 rounded-lg"
class="mx-auto mb-6 rounded-lg w-64"
src={image}
width={200}
height={200}
width={1024}
height={1024}
alt={title}
format="webp"
/>
Expand Down
9 changes: 9 additions & 0 deletions src/styles/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,12 @@ strong {
code {
@apply after:border-none;
}

a:hover {
@apply scale-105;
@apply opacity-60;
}

.a:hover {
@apply opacity-60;
}
8 changes: 1 addition & 7 deletions src/styles/navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ input#nav-toggle:checked ~ #nav-menu {
@apply inline-flex;

label {
@apply relative inline-block h-4 w-6 cursor-pointer rounded-2xl bg-border lg:w-10;
@apply relative inline-block h-4 w-6 cursor-pointer rounded-2xl bg-border;
}

input {
Expand All @@ -70,10 +70,4 @@ input#nav-toggle:checked ~ #nav-menu {
span {
@apply absolute -top-1 left-0 flex h-6 w-6 items-center justify-center rounded-full bg-dark transition-all duration-300 dark:bg-white;
}

input:checked + label {
span {
@apply lg:left-4;
}
}
}

0 comments on commit 8d03a92

Please sign in to comment.