robaertschi.xyz

This commit is contained in:
Robin Bärtschi 2025-02-22 20:53:39 +01:00
parent 6476d54164
commit e0325f865f
7 changed files with 168 additions and 46 deletions

25
src/Accounts.tsx Normal file
View File

@ -0,0 +1,25 @@
import type { FC } from 'hono/jsx';
import Header from './Header';
import Footer from './Footer';
export const Accounts: FC = () => {
return (
<>
<Header />
<main class="middle-flex">
<article>
<ul class="link-list">
<li><a href="https://github.com/RoBaertschi">GitHub</a></li>
<li><a href="https://bsky.app/profile/robaertschi.xyz">Blue Sky</a></li>
<li><a href="https://x.com/RoBaertschi">Twitter</a></li>
<li><a href="https://git.robaertschi.xyz/RoBaertschi">Self Hosted GitTea instance</a></li>
</ul>
</article>
</main>
<Footer />
</>
);
};
export default Accounts;

View File

@ -17,7 +17,7 @@ function BaseDocument(props: SiteData) {
<script src="https://unpkg.com/htmx.org@2.0.4"></script> <script src="https://unpkg.com/htmx.org@2.0.4"></script>
<title>${props.title}</title> <title>${props.title}</title>
</head> </head>
<body hx-boost="true"> <body hx-boost="true" class="middle-flex">
${props.children} ${props.children}
</body> </body>
</html> </html>

9
src/Footer.tsx Normal file
View File

@ -0,0 +1,9 @@
import type { FC } from 'hono/jsx';
export const Footer: FC = () => {
return <footer class="middle-flex">
&copy; 2025 - Robin Bärtschi
</footer>
};
export default Footer;

11
src/Header.tsx Normal file
View File

@ -0,0 +1,11 @@
import type { FC } from 'hono/jsx';
export const Header: FC = () => {
return <header>
<a href="/">/</a>
<span class="header-span"></span>
<a href="/accounts">/accounts</a>
</header>;
};
export default Header;

22
src/Main.tsx Normal file
View File

@ -0,0 +1,22 @@
import type { FC } from 'hono/jsx';
import Footer from './Footer';
import Header from './Header';
export const Main: FC = () => {
return (
<>
<Header />
<main class="middle-flex">
<h1>RoBaertschi</h1>
<article>
Hi 👋, my name is Robin, I am a computer scientist in apprenticeship @ <a href='https://swisscom.com'>Swisscom</a><br />
</article>
</main>
<Footer />
</>
);
};
export default Main;

View File

@ -2,48 +2,24 @@ import { Hono } from 'hono';
import { serveStatic } from 'hono/bun'; import { serveStatic } from 'hono/bun';
import { logger } from 'hono/logger'; import { logger } from 'hono/logger';
import BaseDocument from './BaseDocument'; import BaseDocument from './BaseDocument';
import Main from './Main';
function ImageButton() { import Accounts from './Accounts';
return <button hx-get='/image' hx-target='this' hx-swap="outerHTML">See Meme</button>;
}
const app = new Hono(); const app = new Hono();
app.use(logger()) app.use(logger());
app.use('/static/*', serveStatic({ root: './' })); app.use('/static/*', serveStatic({ root: './' }));
app.get('/', (c) => { app.get("/", c => {
return c.html(<BaseDocument title='Main Page - RoBaertschi'><Main></Main></BaseDocument>);
});
app.get("/accounts", c => {
return c.html( return c.html(
<BaseDocument title='Dockyfied'> <BaseDocument title='Accounts - RoBaertschi'>
<h1>This is a Dockyfied website</h1> <Accounts />
<p>Build using <a href='https://htmx.org/'>htmx</a>.</p>
<ImageButton />
</BaseDocument> </BaseDocument>
); );
}); });
app.get(
'/image',
c => {
return c.html(
<div id="image">
<img hx-get='/image-button' id="image-button" hx-swap='outerHTML' style={'height: 250px;'} src='/static/image.png' hx-target='#image' />
<p>&uarr;</p>
<p>Click the image above to replace with the button again.</p>
<br />
<p id='secret' hx-swap='outerHTML' hx-get='/image2'>Another Meme?</p>
</div>
);
}
);
app.get('/image2',
c => c.html(<img style={'height: 190px;'} src='/static/image2.png' />)
);
app.get(
'/image-button',
c => c.html(<ImageButton />)
);
export default app; export default app;

View File

@ -1,29 +1,108 @@
:root {
--text: 245, 233, 241;
--background: 23, 10, 19;
--primary: 214, 163, 199;
--secondary: 121, 54, 61;
--accent: 164, 226, 46;
--text100: rgb(var(--text));
--text90: rgba(var(--text), 90%);
--background100: rgb(var(--background));
--primary100: rgb(var(--primary));
--secondary100: rgb(var(--secondary));
--secondary90: rgba(var(--secondary), 90%);
--accent100: rgb(var(--accent));
}
body { body {
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh; height: 100vh;
width: 100vw; width: 100vw;
margin: 0;
padding: 0;
color: var(--text100);
background-color: var(--background100);
} }
#image { main {
height: fit-content; height: 100%;
}
.middle-flex {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
#image-button:hover { a {
color: var(--text100);
}
a:hover {
color: var(--text90);
}
a:visited {
color: var(--text100);
}
button.primary {
background-color: var(--primary100);
border-color: var(--primary100);
border-radius: 0.5rem;
display: inline-block;
padding: 0.5em 2em;
margin: 0;
}
button.primary:hover {
transform: translate(0, -3px);
box-shadow: 0 1.2em 4em -0.2em var(--primary100);
cursor: pointer; cursor: pointer;
} }
#secret { .link-list li {
font-size: 0.4em; list-style: none;
padding: 0.2rem;
} }
#secret:hover { header {
cursor: pointer; border: 0;
padding: 1em;
border-bottom: 0.1em;
border-color: var(--secondary100);
border-style: solid;
width: 80%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
header a {
padding: 0.2em 0.7em;
font-size: 1.3rem;
}
.header-span {
border-width: 0.1em;
border-style: solid;
border-color: var(--secondary90);
height: 70%;
}
footer {
border: 0;
padding: 1em;
border-top: 0.1em;
border-color: var(--secondary100);
border-style: solid;
width: 80%;
} }