Updated styling

This commit is contained in:
Anton Pogrebnjak
2025-02-16 17:25:40 +01:00
parent 810280fd33
commit 9e02d262be
10 changed files with 152 additions and 59 deletions

19
public/logo.svg Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="89" height="45">
<defs>
<mask id="eye">
<circle cx="0" cy="0" r="13" fill="white"/>
<circle cx="0" cy="0" r="8" fill="black"/>
<circle cx="0" cy="0" r="3" fill="white"/>
</mask>
</defs>
<path d="M-16 -11 L10 -11 C18 -11, 18 -25, 10 -25 L10 -21 C13 -21, 13 -15, 10 -15 L-16 -15 Z" fill="#FFFFFF" transform="translate(13 25)" />
<circle cx="0" cy="0" r="13" mask="url(#eye)" fill="white" transform="translate(13 25)"/>
<path d="M-16 -11 L10 -11 C18 -11, 18 -25, 10 -25 L10 -21 C13 -21, 13 -15, 10 -15 L-16 -15 Z" fill="#FFFFFF" transform="translate(73 25)" />
<circle cx="0" cy="0" r="13" mask="url(#eye)" fill="#FFFFFF" transform="translate(73 25)"/>
<path d="M0 3 L25 3 L25 0 L0 0 Z" fill="#FFFFFF" transform="translate(27, 42)" />
</svg>

After

Width:  |  Height:  |  Size: 877 B

View File

@@ -23,7 +23,7 @@ const today = new Date();
</footer> </footer>
<style> <style>
footer { footer {
background-color: var(--background); background-color: var(--background-soft);
padding: 1rem 1rem 2rem; padding: 1rem 1rem 2rem;
width: 100%; width: 100%;
} }

View File

@@ -5,7 +5,9 @@ import HeaderLink from "./HeaderLink.astro";
<header> <header>
<nav> <nav>
<a class="logo" href="/"><img src="/logo.png" alt="ಠ_ಠ" /></a> <a class="logo" href="/">
<img src="/logo.svg" alt="ಠ_ಠ" />
</a>
<div class="internal-links"> <div class="internal-links">
<HeaderLink href="/">Home</HeaderLink> <HeaderLink href="/">Home</HeaderLink>
<HeaderLink href="/projects">Projects</HeaderLink> <HeaderLink href="/projects">Projects</HeaderLink>
@@ -36,8 +38,7 @@ import HeaderLink from "./HeaderLink.astro";
margin: 0; margin: 0;
padding: 0 1em; padding: 0 1em;
width: 100%; width: 100%;
background: var(--background); background-color: var(--background-soft);
box-shadow: var(--standard-box-shadow);
} }
header .logo { header .logo {
@@ -50,8 +51,7 @@ import HeaderLink from "./HeaderLink.astro";
} }
header .logo img { header .logo img {
width: 96px; height: 24pt;
height: 96px;
} }
nav { nav {
@@ -61,7 +61,7 @@ import HeaderLink from "./HeaderLink.astro";
} }
nav a { nav a {
padding: 1em 0.5em; padding: .4em 0.5em;
color: var(--text); color: var(--text);
border-bottom: 4px solid transparent; border-bottom: 4px solid transparent;
text-decoration: none; text-decoration: none;
@@ -76,13 +76,14 @@ import HeaderLink from "./HeaderLink.astro";
.social-links a { .social-links a {
display: flex; display: flex;
} }
@media (max-width: 720px) {
.logo {
display: none;
}
.logo img { @media (max-width: 720px) {
display: none; header .logo img {
} height: 18pt;
}
nav {
font-size: 16px;
}
} }
</style> </style>

72
src/components/Main.astro Normal file
View File

@@ -0,0 +1,72 @@
---
import { ClientRouter } from "astro:transitions";
---
<canvas id="dotted-background" transition:persist></canvas>
<main transition:name="main" transition:animate="slide">
<slot />
</main>
<style>
canvas#dotted-background {
position: fixed;
top: 0;
left: 0;
z-index: -1;
}
</style>
<script type="module" transition:persist>
let canvas = document.getElementById("dotted-background");
let ctx = canvas.getContext("2d");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
let gap = 20;
let mouse = { x: canvas.width / 2, y: canvas.height / 2 };
document.addEventListener("mousemove", (e) => {
mouse.x = e.clientX;
mouse.y = e.clientY;
});
let distanceThreshold = .2;
let baseOpacity = .05;
let baseRadius = 1;
const draw = () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (let x = gap; x < canvas.width; x += gap) {
for (let y = gap; y < canvas.height; y += gap) {
// mouse distance
const mouseDistance = Math.sqrt(
Math.pow(mouse.x - x, 2) +
Math.pow(mouse.y - y, 2)
);
// normalized mouse distance
const normalizedMouseDistance = mouseDistance / Math.sqrt(
Math.pow(canvas.width, 2) +
Math.pow(canvas.height, 2)
);
const opacity = Math.max(baseOpacity, .4 - normalizedMouseDistance / distanceThreshold);
const radius = baseRadius + Math.max(0, 1 - normalizedMouseDistance / distanceThreshold);
// draw dots
ctx.fillStyle = `rgba(255, 255, 255, ${opacity})`;
ctx.beginPath();
ctx.arc(x, y, radius, 0, Math.PI * 2);
ctx.fill();
ctx.closePath();
}
}
};
setInterval(() => {
draw();
}, 1000 / 60);
</script>

View File

@@ -2,6 +2,7 @@
import type { CollectionEntry } from "astro:content"; import type { CollectionEntry } from "astro:content";
import BaseHead from "../components/BaseHead.astro"; import BaseHead from "../components/BaseHead.astro";
import Header from "../components/Header.astro"; import Header from "../components/Header.astro";
import Main from "../components/Main.astro";
import Footer from "../components/Footer.astro"; import Footer from "../components/Footer.astro";
import FormattedDate from "../components/FormattedDate.astro"; import FormattedDate from "../components/FormattedDate.astro";
@@ -100,7 +101,7 @@ const { title, description, pubDate, updatedDate, heroImage } = Astro.props;
<body> <body>
<Header /> <Header />
<main> <Main>
<article> <article>
<div class="hero-image"> <div class="hero-image">
{ {
@@ -132,7 +133,7 @@ const { title, description, pubDate, updatedDate, heroImage } = Astro.props;
<slot /> <slot />
</div> </div>
</article> </article>
</main> </Main>
<Footer /> <Footer />
</body> </body>
</html> </html>

View File

@@ -1,6 +1,7 @@
--- ---
import BaseHead from "../components/BaseHead.astro"; import BaseHead from "../components/BaseHead.astro";
import Header from "../components/Header.astro"; import Header from "../components/Header.astro";
import Main from "../components/Main.astro";
import Footer from "../components/Footer.astro"; import Footer from "../components/Footer.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../consts"; import { SITE_TITLE, SITE_DESCRIPTION } from "../consts";
--- ---
@@ -12,13 +13,13 @@ import { SITE_TITLE, SITE_DESCRIPTION } from "../consts";
</head> </head>
<body> <body>
<Header /> <Header />
<main> <Main>
<h1>Anton Pogrebnjak</h1> <h1>Anton Pogrebnjak</h1>
<p> <p>
Really, I don't have much to tell you about myself. Just look at the amazing stuff I've done and written about. That should suffice. Really, I don't have much to tell you about myself. Just look at the amazing stuff I've done and written about. That should suffice.
</p> </p>
<p style="float: right; text-align: end;">Kind regards,<br>Anton</p> <p style="float: right; text-align: end;">Kind regards,<br>Anton</p>
</main> </Main>
<Footer /> <Footer />
</body> </body>

View File

@@ -1,6 +1,7 @@
--- ---
import BaseHead from '../../components/BaseHead.astro'; import BaseHead from '../../components/BaseHead.astro';
import Header from '../../components/Header.astro'; import Header from '../../components/Header.astro';
import Main from '../../components/Main.astro';
import Footer from '../../components/Footer.astro'; import Footer from '../../components/Footer.astro';
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts'; import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
import { getCollection } from 'astro:content'; import { getCollection } from 'astro:content';
@@ -19,13 +20,13 @@ const posts: Post[] = (await getCollection('blog')).map(convertPost).sort(
</head> </head>
<body> <body>
<Header /> <Header />
<main> <Main>
{posts.length === 0 ? ( {posts.length === 0 ? (
<h1 style="opacity: .5; user-select: none;">No posts yet &#128539;</h1> <h1 style="opacity: .5; user-select: none;">No posts yet &#128539;</h1>
) : ( ) : (
<Showcase collection="blog" posts={posts} /> <Showcase collection="blog" posts={posts} />
)} )}
</main> </Main>
<Footer /> <Footer />
</body> </body>
</html> </html>

View File

@@ -1,6 +1,7 @@
--- ---
import BaseHead from "../components/BaseHead.astro"; import BaseHead from "../components/BaseHead.astro";
import Header from "../components/Header.astro"; import Header from "../components/Header.astro";
import Main from "../components/Main.astro";
import Footer from "../components/Footer.astro"; import Footer from "../components/Footer.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from "../consts"; import { SITE_TITLE, SITE_DESCRIPTION } from "../consts";
import Showcase from "../components/Showcase.astro"; import Showcase from "../components/Showcase.astro";
@@ -19,7 +20,7 @@ const posts: Post[] = (await getCollection("projects"))
</head> </head>
<body> <body>
<Header /> <Header />
<main> <Main>
<section id="welcome"> <section id="welcome">
<h1>Hi &#128075;, my name is <a href="/about">Anton</a></h1> <h1>Hi &#128075;, my name is <a href="/about">Anton</a></h1>
<h2 class="typeout"> <h2 class="typeout">
@@ -34,9 +35,9 @@ const posts: Post[] = (await getCollection("projects"))
</section> </section>
<section id="projects"> <section id="projects">
<Showcase color="black" collection="projects" posts={posts} /> <Showcase color="var(--text)" collection="projects" posts={posts} />
</section> </section>
</main> </Main>
<Footer /> <Footer />
</body><script> </body><script>
const typeout = document.querySelectorAll(".typeout"); const typeout = document.querySelectorAll(".typeout");
@@ -58,13 +59,6 @@ const posts: Post[] = (await getCollection("projects"))
</script> </script>
<style> <style>
main {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
section { section {
padding: 2rem; padding: 2rem;
border-radius: .75em; border-radius: .75em;
@@ -82,12 +76,9 @@ const posts: Post[] = (await getCollection("projects"))
} }
#projects { #projects {
background-color: var(--primary); border: 2px solid var(--primary);
color: var(--background); border-radius: .75em;
} color: var(--text);
#projects .title {
color: var(--background);
} }
.buttons { .buttons {
@@ -110,5 +101,21 @@ const posts: Post[] = (await getCollection("projects"))
background-color: var(--accent); background-color: var(--accent);
transition: background-color 0.2s; transition: background-color 0.2s;
} }
@media (max-width: 720px) {
max-width: 100%;
section {
padding: 1rem;
}
#welcome h1 {
font-size: 1.5rem;
}
#welcome h2 {
font-size: 1rem;
}
}
</style> </style>
</html> </html>

View File

@@ -1,6 +1,7 @@
--- ---
import BaseHead from '../../components/BaseHead.astro'; import BaseHead from '../../components/BaseHead.astro';
import Header from '../../components/Header.astro'; import Header from '../../components/Header.astro';
import Main from '../../components/Main.astro';
import Footer from '../../components/Footer.astro'; import Footer from '../../components/Footer.astro';
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts'; import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
import { getCollection } from 'astro:content'; import { getCollection } from 'astro:content';
@@ -19,13 +20,13 @@ const posts: Post[] = (await getCollection('projects')).map(convertPost).sort(
</head> </head>
<body> <body>
<Header /> <Header />
<main> <Main>
{posts.length === 0 ? ( {posts.length === 0 ? (
<h1 style="opacity: .5; user-select: none;">No posts yet &#128539;</h1> <h1 style="opacity: .5; user-select: none;">No posts yet &#128539;</h1>
) : ( ) : (
<Showcase collection="projects" posts={posts} /> <Showcase collection="projects" posts={posts} />
)} )}
</main> </Main>
<Footer /> <Footer />
</body> </body>
</html> </html>

View File

@@ -28,6 +28,7 @@
--text: #ffffff; --text: #ffffff;
--text-soft: #ddd; --text-soft: #ddd;
--background: #121212; --background: #121212;
--background-soft: #212121;
--primary: #2df598; --primary: #2df598;
--primary-soft: #22cf7e; --primary-soft: #22cf7e;
--secondary: #222021; --secondary: #222021;
@@ -69,16 +70,6 @@ b {
font-weight: 700; font-weight: 700;
} }
a.more {
display: block;
margin-top: 2em;
font-weight: bold;
}
.indent {
margin-left: 2em;
}
i { i {
font-size: 2rem; font-size: 2rem;
color: #ffffff; color: #ffffff;
@@ -87,6 +78,10 @@ i {
main { main {
position: relative; position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 60vw; width: 60vw;
} }
@@ -142,16 +137,6 @@ code {
color: var(--accent); color: var(--accent);
} }
.wink::after {
content: "ಠ_ಠ";
font-family: "Ubuntu";
}
.wink:hover::after {
content: "ಠ‿↼";
font-family: "Ubuntu";
}
textarea { textarea {
width: 100%; width: 100%;
font-size: 16px; font-size: 16px;
@@ -207,9 +192,14 @@ hr {
body { body {
font-size: 18px; font-size: 18px;
} }
.logo img {
height: 18px;
}
main { main {
width: 100vw; width: 100vw;
padding: 1em; padding: 8px;
} }
header .logo { header .logo {