Skip to content

Commit

Permalink
create mvp for svelte markdown blog
Browse files Browse the repository at this point in the history
  • Loading branch information
isala404 committed Nov 27, 2024
1 parent 765f2ed commit 69751b7
Show file tree
Hide file tree
Showing 30 changed files with 1,006 additions and 133 deletions.
Binary file modified bun.lockb
Binary file not shown.
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.36.0",
"globals": "^15.0.0",
"mdsvex": "^0.11.2",
"lucide-svelte": "^0.461.0",
"mdsvex": "^0.12.3",
"postcss": "^8.4.32",
"postcss-nesting": "^13.0.1",
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.2.6",
"rehype-slug": "^6.0.0",
"remark-toc": "^9.0.0",
"shiki": "^1.23.1",
"shiki-transformer-copy-button": "^0.0.3",
"svelte": "^5.0.0",
"svelte-adapter-bun": "^0.5.2",
"svelte-carousel": "^1.0.25",
Expand All @@ -39,5 +45,8 @@
"format": "prettier --write .",
"lint": "prettier --check . && eslint ."
},
"type": "module"
"type": "module",
"dependencies": {
"caniuse-lite": "^1.0.30001684"
}
}
1 change: 1 addition & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
plugins: {
'postcss-nesting': {},
tailwindcss: {},
autoprefixer: {}
}
Expand Down
193 changes: 193 additions & 0 deletions src/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,196 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
body {
@apply bg-white dark:bg-gray-900;
}
}

/* Hide scrollbar for Chrome, Safari and Opera */
.no-scrollbar::-webkit-scrollbar {
display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.no-scrollbar {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}

@layer components {
.posts {
@apply py-8 space-y-8 text-gray-900 dark:text-gray-100;
}

.post {
@apply space-y-2 bg-white dark:bg-gray-900 rounded-lg p-4;
}

.post .title {
@apply text-2xl font-bold text-gray-900 dark:text-white hover:text-blue-600 dark:hover:text-blue-400 transition-colors;
}

.post .date {
@apply text-sm text-gray-600 dark:text-gray-400;
}

.post .description {
@apply text-gray-700 dark:text-gray-300;
}

article {
@apply max-w-3xl mx-auto py-8 px-4 text-gray-900 dark:text-gray-100;
}

article hgroup {
@apply mb-4 space-y-2;
}

article hgroup h1 {
@apply text-4xl font-bold text-gray-900 dark:text-white;
}

article hgroup p {
@apply text-sm text-gray-600 dark:text-gray-400;
}

article .tags {
@apply flex gap-2 mb-8;
}

article .tags span {
@apply px-2 py-1 rounded text-sm bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300;
}

.prose {
@apply space-y-6 text-gray-900 dark:text-gray-100;
@apply max-w-none;
}

.prose h1 {
@apply text-4xl font-bold mt-12 mb-6 text-gray-900 dark:text-white;
}

.prose h2 {
@apply text-3xl font-bold mt-8 mb-4 text-gray-900 dark:text-white;
}

.prose h3 {
@apply text-2xl font-bold mt-6 mb-3 text-gray-900 dark:text-white;
}

.prose h4 {
@apply text-xl font-bold mt-4 mb-2 text-gray-900 dark:text-white;
}

.prose h5 {
@apply text-lg font-bold mt-3 mb-2 text-gray-900 dark:text-white;
}

.prose h6 {
@apply text-base font-bold mt-2 mb-1 text-gray-900 dark:text-white;
}

.prose p {
@apply leading-7 text-gray-800 dark:text-gray-200;
@apply text-lg leading-relaxed mb-6;
}

.prose a {
@apply text-blue-600 dark:text-blue-400 hover:underline;
}

.prose ul {
@apply list-disc list-inside space-y-2 ml-4 text-gray-800 dark:text-gray-200;
}

.prose ol {
@apply list-decimal list-inside space-y-2 ml-4 text-gray-800 dark:text-gray-200;
}

.prose blockquote {
@apply border-l-4 border-gray-200 dark:border-gray-700 pl-4 italic text-gray-700 dark:text-gray-300 bg-gray-50 dark:bg-gray-800/50 py-2 rounded-r;
@apply my-8 pl-6 border-l-4 border-blue-500 italic;
}

.prose img {
@apply max-w-full h-auto rounded-lg border border-gray-200 dark:border-gray-700;
@apply my-8 rounded-xl shadow-lg;
}

.prose pre {
@apply bg-gray-100 dark:bg-gray-800 p-4 rounded-lg overflow-x-auto border border-gray-200 dark:border-gray-700;
@apply my-8;
}

.prose code:not(pre code) {
@apply bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded text-sm text-gray-800 dark:text-gray-200 border border-gray-200 dark:border-gray-700;
}

.prose table {
@apply w-full border-collapse my-6;
}

.prose table th {
@apply bg-gray-100 dark:bg-gray-800 text-left p-2 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-white;
}

.prose table td {
@apply p-2 border border-gray-200 dark:border-gray-700 text-gray-800 dark:text-gray-200;
}

.prose hr {
@apply border-gray-200 dark:border-gray-700 my-8;
}
}

pre:has(code) {
position: relative;
/* @apply bg-gray-100 dark:bg-gray-800; */
}

pre button.copy {
position: absolute;
right: 10px;
top: 10px;
width: 18px;
height: 18px;
padding: 0;
display: flex;
@apply rounded transition-colors;

& span {
width: 100%;
aspect-ratio: 1 / 1;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}

& .ready {
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1jb3B5Ij48cmVjdCB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHg9IjgiIHk9IjgiIHJ4PSIyIiByeT0iMiIvPjxwYXRoIGQ9Ik00IDE2Yy0xLjEgMC0yLS45LTItMlY0YzAtMS4xLjktMiAyLTJoMTBjMS4xIDAgMiAuOSAyIDIiLz48L3N2Zz4=');
}

& .success {
display: none;
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1jaGVjayI+PHBhdGggZD0iTTIwIDYgOSAxN2wtNS01Ii8+PC9zdmc+');
}

&.copied {
& .success {
display: block;
}

& .ready {
display: none;
}
}
}

@media (prefers-color-scheme: dark) {
.dark-icon-white {
filter: brightness(0) invert(1);
}
}
4 changes: 2 additions & 2 deletions src/lib/about-me/stats.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let { data }: Props = $props();
</script>

<h3 class="text-xl my-4">Nerd Stats</h3>
<h3 class="text-xl my-4 text-gray-900 dark:text-gray-100">Nerd Stats</h3>
{#if browser}
<div class="w-full text-center">
<Carousel
Expand All @@ -26,7 +26,7 @@
></div>
<div class="z-20 absolute w-full text-center">
<img src={stat.icon} alt={stat.title} class="w-10 h-10 mx-auto opacity-75" />
<p class="text-lg">{stat.value} {stat.title}</p>
<p class="text-lg text-gray-900 dark:text-gray-100">{stat.value} {stat.title}</p>
</div>
</div>
{/each}
Expand Down
10 changes: 10 additions & 0 deletions src/lib/components/custom/img.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script lang="ts">
type Props = {
src: string;
alt: string;
};
let { src, alt }: Props = $props();
</script>

<img {src} {alt} loading="lazy" />
3 changes: 3 additions & 0 deletions src/lib/components/custom/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import img from './img.svelte';

export { img };
2 changes: 1 addition & 1 deletion src/lib/credentials.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2 class="text-2xl font-bold mb-5">Credentials</h2>
<h2 class="text-2xl font-bold mb-5 text-gray-900 dark:text-gray-100">Credentials</h2>
<div class="w-auto text-center flex flex-row flex-wrap justify-center">
<a href="https://www.credly.com/badges/94b77613-5470-4e2b-9a3f-7dd9891737eb" target="_blank">
<enhanced:img
Expand Down
6 changes: 3 additions & 3 deletions src/lib/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
},
{
"title": "Talks Given",
"value": 6,
"value": 7,
"color": "bg-slate-100",
"icon": "/icons/presentation.svg"
},
{
"title": "Hackathons Attended",
"title": "Events Attended",
"value": 8,
"color": "bg-cyan-100",
"icon": "/icons/rocket.svg"
},
{
"title": "Tech T-shirts Owned",
"value": 28,
"value": 29,
"color": "bg-purple-100",
"icon": "/icons/t-shirt.svg"
}
Expand Down
12 changes: 8 additions & 4 deletions src/lib/github.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
let { title, description, tag, link, stars, forks, color }: Props = $props();
</script>

<div class="border bg-card text-card-foreground w-[21rem] shadow-lg rounded-lg overflow-hidden m-3">
<div
class="border bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 w-[21rem] shadow-lg rounded-lg overflow-hidden m-3"
>
<div class="p-6">
<div class="flex justify-between items-center">
<div class="flex items-center">
<div class="flex items-center dark-icon-white">
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
Expand All @@ -33,13 +35,15 @@
></path>
<path d="M9 18c-4.51 2-5-2-7-2"></path>
</svg>
<h3 class="tracking-tight text-lg font-bold text-gray-900 ml-2">{title}</h3>
<h3 class="tracking-tight text-lg font-bold text-gray-900 dark:text-gray-100 ml-2">
{title}
</h3>
</div>
<div class="text-gray-100 {color} text-sm font-medium px-2 py-1 rounded-md">
{tag}
</div>
</div>
<p class="text-sm mt-4 text-gray-600 text-left">{description}</p>
<p class="text-sm mt-4 text-gray-600 dark:text-gray-300 text-left">{description}</p>
<div class="mt-4 flex items-center justify-between">
<div class="flex items-center">
<svg
Expand Down
12 changes: 6 additions & 6 deletions src/lib/icons.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<div class="my-auto flex flex-row justify-center items-center mt-4">
<a href="https://github.com/isala404" target="_blank">
<img src="/icons/github.svg" alt="Github" class="h-6 mx-1" />
<img src="/icons/github.svg" alt="Github" class="h-6 mx-1 dark-icon-white" />
</a>
<a href="https://twitter.com/isala404" target="_blank">
<img src="/icons/x.svg" alt="X.com" class="h-6 mx-1" />
<img src="/icons/x.svg" alt="X.com" class="h-6 mx-1 dark-icon-white" />
</a>
<a href="https://www.medium.com/@isalapiyarisi" target="_blank">
<img src="/icons/medium.svg" alt="Medium" class="h-6 mx-1" />
<img src="/icons/medium.svg" alt="Medium" class="h-6 mx-1 dark-icon-white" />
</a>
<a href="https://www.instagram.com/isala404" target="_blank">
<img src="/icons/instagram.svg" alt="Instagram" class="h-6 mx-1" />
<img src="/icons/instagram.svg" alt="Instagram" class="h-6 mx-1 dark-icon-white" />
</a>
<a href="https://www.linkedin.com/in/isalapiyarisi" target="_blank">
<img src="/icons/linkedin.svg" alt="LinkedIn" class="h-6 mx-1" />
<img src="/icons/linkedin.svg" alt="LinkedIn" class="h-6 mx-1 dark-icon-white" />
</a>
<a href="https://open.spotify.com/user/mrsupiri" target="_blank">
<img src="/icons/spotify.svg" alt="Spotify" class="h-6 mx-1" />
<img src="/icons/spotify.svg" alt="Spotify" class="h-6 mx-1 dark-icon-white" />
</a>
</div>
10 changes: 6 additions & 4 deletions src/lib/medium.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@
</script>

<div
class="border text-card-foreground bg-white rounded-xl shadow-md overflow-hidden max-w-[26rem] text-left mix-h-40 flex flex-row m-4"
class="border text-card-foreground bg-white dark:bg-gray-800 rounded-xl shadow-md overflow-hidden max-w-[26rem] text-left mix-h-40 flex flex-row m-4"
>
<div class="max-w-40">
<img class={'max-w-40 object-cover w-96 h-full ' + align} src={image} alt="Article thumbnail" />
<img class={'max-w-40 object-cover w-96 h-full dark-icon-white' + align} src={image} alt="Article thumbnail" />
</div>
<div class="p-2 flex flex-col max-w-[19rem]">
<h2 class="block mt-1 text-lg leading-tight font-medium text-black">{title}</h2>
<p class="text-gray-500 text-sm mt-1 text-justify mr-2">
<h2 class="block mt-1 text-lg leading-tight font-medium text-gray-900 dark:text-gray-100">
{title}
</h2>
<p class="text-gray-600 dark:text-gray-300 text-sm mt-1 text-justify mr-2">
{description}
</p>
<div class="w-full text-right mt-auto">
Expand Down
Loading

0 comments on commit 69751b7

Please sign in to comment.