Update some styles of my blog
This commit is contained in:
parent
c2ed18a27d
commit
69e344a4a5
6 changed files with 38 additions and 107 deletions
|
|
@ -1,5 +1,4 @@
|
|||
---
|
||||
import Social from "./Social.astro";
|
||||
---
|
||||
|
||||
<style>
|
||||
|
|
@ -8,8 +7,14 @@ import Social from "./Social.astro";
|
|||
gap: 1rem;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
.legal-information {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
line-height: 1.6;
|
||||
}
|
||||
</style>
|
||||
|
||||
<footer>
|
||||
<Social platform="github" username="Daisuke897" />
|
||||
<p class="legal-information">© 2025 Nakahara Daisuke</p>
|
||||
</footer>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
import Hamburger from "./Hamburger.astro";
|
||||
import Navigation from "./Navigation.astro";
|
||||
import ThemeIcon from './ThemeIcon.astro';
|
||||
---
|
||||
|
||||
<header>
|
||||
<nav>
|
||||
<Hamburger />
|
||||
<ThemeIcon />
|
||||
<Navigation />
|
||||
</nav>
|
||||
</header>
|
||||
|
|
|
|||
|
|
@ -1,73 +0,0 @@
|
|||
---
|
||||
|
||||
---
|
||||
|
||||
<button id="themeToggle">
|
||||
<svg width="30px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path
|
||||
class="sun"
|
||||
fill-rule="evenodd"
|
||||
d="M12 17.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zm0 1.5a7 7 0 1 0 0-14 7 7 0 0 0 0 14zm12-7a.8.8 0 0 1-.8.8h-2.4a.8.8 0 0 1 0-1.6h2.4a.8.8 0 0 1 .8.8zM4 12a.8.8 0 0 1-.8.8H.8a.8.8 0 0 1 0-1.6h2.5a.8.8 0 0 1 .8.8zm16.5-8.5a.8.8 0 0 1 0 1l-1.8 1.8a.8.8 0 0 1-1-1l1.7-1.8a.8.8 0 0 1 1 0zM6.3 17.7a.8.8 0 0 1 0 1l-1.7 1.8a.8.8 0 1 1-1-1l1.7-1.8a.8.8 0 0 1 1 0zM12 0a.8.8 0 0 1 .8.8v2.5a.8.8 0 0 1-1.6 0V.8A.8.8 0 0 1 12 0zm0 20a.8.8 0 0 1 .8.8v2.4a.8.8 0 0 1-1.6 0v-2.4a.8.8 0 0 1 .8-.8zM3.5 3.5a.8.8 0 0 1 1 0l1.8 1.8a.8.8 0 1 1-1 1L3.5 4.6a.8.8 0 0 1 0-1zm14.2 14.2a.8.8 0 0 1 1 0l1.8 1.7a.8.8 0 0 1-1 1l-1.8-1.7a.8.8 0 0 1 0-1z"
|
||||
></path>
|
||||
<path
|
||||
class="moon"
|
||||
fill-rule="evenodd"
|
||||
d="M16.5 6A10.5 10.5 0 0 1 4.7 16.4 8.5 8.5 0 1 0 16.4 4.7l.1 1.3zm-1.7-2a9 9 0 0 1 .2 2 9 9 0 0 1-11 8.8 9.4 9.4 0 0 1-.8-.3c-.4 0-.8.3-.7.7a10 10 0 0 0 .3.8 10 10 0 0 0 9.2 6 10 10 0 0 0 4-19.2 9.7 9.7 0 0 0-.9-.3c-.3-.1-.7.3-.6.7a9 9 0 0 1 .3.8z"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<style>
|
||||
#themeToggle {
|
||||
border: 0;
|
||||
background: none;
|
||||
}
|
||||
.sun {
|
||||
fill: black;
|
||||
}
|
||||
.moon {
|
||||
fill: transparent;
|
||||
}
|
||||
|
||||
:global(.dark) .sun {
|
||||
fill: transparent;
|
||||
}
|
||||
:global(.dark) .moon {
|
||||
fill: white;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script is:inline>
|
||||
const theme = (() => {
|
||||
if (
|
||||
typeof localStorage !== "undefined" &&
|
||||
localStorage.getItem("theme")
|
||||
) {
|
||||
return localStorage.getItem("theme") ?? "light";
|
||||
}
|
||||
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
||||
return "dark";
|
||||
}
|
||||
return "light";
|
||||
})();
|
||||
|
||||
if (theme === "light") {
|
||||
document.documentElement.classList.remove("dark");
|
||||
} else {
|
||||
document.documentElement.classList.add("dark");
|
||||
}
|
||||
|
||||
window.localStorage.setItem("theme", theme);
|
||||
|
||||
const handleToggleClick = () => {
|
||||
const element = document.documentElement;
|
||||
element.classList.toggle("dark");
|
||||
|
||||
const isDark = element.classList.contains("dark");
|
||||
localStorage.setItem("theme", isDark ? "dark" : "light");
|
||||
};
|
||||
|
||||
document
|
||||
.getElementById("themeToggle")
|
||||
?.addEventListener("click", handleToggleClick);
|
||||
</script>
|
||||
|
|
@ -17,7 +17,7 @@ const { pageTitle } = Astro.props;
|
|||
<Header />
|
||||
<h1>{pageTitle}</h1>
|
||||
<slot />
|
||||
<Footer />
|
||||
<Footer>
|
||||
<script>
|
||||
import "../scripts/menu.js";
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import BaseLayout from "../layouts/BaseLayout.astro";
|
||||
import BlogPost from "../components/BlogPost.astro";
|
||||
import { getCollection } from "astro:content";
|
||||
const pageTitle = "Naputo 学びを形に";
|
||||
const pageTitle = "Naputo";
|
||||
const allPosts = await getCollection("blog");
|
||||
---
|
||||
|
||||
|
|
@ -20,16 +20,25 @@ const allPosts = await getCollection("blog");
|
|||
align-items: center;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
.rounded-button {
|
||||
padding: 10px 20px;
|
||||
background-color: rgba(192, 192, 192, 0.3);
|
||||
border-radius: 10px;
|
||||
font-size: 16px;
|
||||
.list-of-articles-button {
|
||||
display: inline-block;
|
||||
background-color: #e0e0e0;
|
||||
color: #333333;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
padding: 12px 24px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
text-decoration: none;
|
||||
transition: background-color 0.3s ease, transform 0.3s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
.list-of-articles-button:hover {
|
||||
background-color: #cacaca;
|
||||
}
|
||||
</style>
|
||||
<BaseLayout pageTitle={pageTitle}>
|
||||
<h2>20代のエンジニアによる技術や書評のアウトプットブログ</h2>
|
||||
<h3 class="header-new-posts">新しい記事</h3>
|
||||
<h3 class="header-new-posts">New Posts</h3>
|
||||
<div class="new-articles">
|
||||
{
|
||||
allPosts.slice(0, 6).map((post: any) => (
|
||||
|
|
@ -47,6 +56,6 @@ const allPosts = await getCollection("blog");
|
|||
</div>
|
||||
|
||||
<div class="button-container">
|
||||
<a href="/blog/" class="rounded-button">記事の一覧</a>
|
||||
<a href="/blog/" class="list-of-articles-button">List of Article</a>
|
||||
</div>
|
||||
</BaseLayout>
|
||||
|
|
|
|||
|
|
@ -28,34 +28,35 @@ h1 {
|
|||
|
||||
.hamburger .line {
|
||||
display: block;
|
||||
width: 40px;
|
||||
height: 5px;
|
||||
margin-bottom: 10px;
|
||||
background-color: #ff9776;
|
||||
width: 32px;
|
||||
height: 4px;
|
||||
margin-bottom: 8px;
|
||||
background-color: #333333;
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
width: 100%;
|
||||
top: 5rem;
|
||||
left: 48px;
|
||||
background-color: #ff9776;
|
||||
display: none;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.nav-links a {
|
||||
display: block;
|
||||
text-align: center;
|
||||
padding: 10px 0;
|
||||
padding: 10px 20px;
|
||||
text-decoration: none;
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
border-radius: 4px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.nav-links a:hover,
|
||||
.nav-links a:focus {
|
||||
background-color: #ff9776;
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
|
||||
.expanded {
|
||||
|
|
@ -80,13 +81,4 @@ h1 {
|
|||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
html.dark {
|
||||
background-color: #0d0950;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.dark .nav-links a {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue