Skip to content

Commit

Permalink
Merge pull request #6 from efergus/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
efergus authored Jul 10, 2024
2 parents 3f44cc6 + a21c578 commit 87f3eea
Show file tree
Hide file tree
Showing 14 changed files with 234 additions and 176 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"dependencies": {
"clsx": "^2.1.1",
"highlight.js": "^11.9.0",
"svelte-highlight": "^7.6.1",
"svelte-markdown": "^0.4.1"
}
}
12 changes: 7 additions & 5 deletions src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@
@apply light stroke-2;
}

div.theme-reset:has(:not(.theme-reset) > label > input.dark-mode-toggle) {
div:has(> .theme-focus > label > input.dark-mode-toggle) {
@apply light;
}

div.theme-reset:has(
:not(.theme-reset) > label > input.dark-mode-toggle:checked
) {
div:has(> .theme-focus > label > input.dark-mode-toggle:checked) {
@apply dark;
}

Expand All @@ -44,7 +42,11 @@
@apply dark;
}

div.theme-node:has(label > input.dark-mode-toggle:checked) {
div:has(> .theme-focus > label > input.dark-mode-toggle) {
@apply dark;
}

div:has(> .theme-focus > label > input.dark-mode-toggle:checked) {
@apply light;
}
}
Expand Down
13 changes: 10 additions & 3 deletions src/lib/components/Code.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<script lang="ts">
export let source = "";
export let lang = "";
import Highlight from "svelte-highlight";
import atom from "svelte-highlight/styles/atom-one-dark";
export let source: string;
export let lang: any;
</script>

<pre><code class={lang ? `language-${lang}` : ""}>{source}</code></pre>
<svelte:head>
{@html atom}
</svelte:head>

<Highlight language={lang} code={source} />
33 changes: 15 additions & 18 deletions src/lib/components/PageMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
document.addEventListener("touchmove", listener);
};
});
$: console.log({ open });
</script>

<label bind:this={label} class={clsx("hover:cursor-pointer", { adaptive })}>
Expand Down Expand Up @@ -54,14 +52,16 @@
</svg>
</div>

<!-- svelte-ignore a11y-click-events-have-key-events a11y-no-static-element-interactions -->
<div
class={clsx("clip", {
adaptive,
})}
>
<div class="menu">
<slot />
<div class="relative">
<!-- svelte-ignore a11y-click-events-have-key-events a11y-no-static-element-interactions -->
<div
class={clsx("clip", {
adaptive,
})}
>
<div class="menu">
<slot />
</div>
</div>
</div>
</label>
Expand All @@ -71,22 +71,19 @@
label {
@apply w-full relative;
}
label input:checked ~ div > div.menu {
label input:checked ~ div div.menu {
transform: translateY(0);
}
input.menu:checked ~ .title {
opacity: 0;
}
/* position/style */
div.title {
@apply transition-opacity opacity-100 flex items-center grow;
}
div.menu {
@apply transition-transform -translate-y-full overflow-auto pointer-events-auto w-full max-h-screen;
}
div.title {
@apply transition-opacity opacity-100 flex items-center grow;
}
div.bar {
@apply flex justify-stretch items-center p-2 w-full;
@apply flex justify-stretch items-center p-2 w-full relative;
}
div.clip {
@apply absolute top-0 overflow-hidden pointer-events-none w-full;
Expand Down
4 changes: 0 additions & 4 deletions src/lib/markdown/markdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@
.markdown p > code {
@apply bg-secondary/30 rounded px-1 py-0.5;
}

.markdown pre:has(code) {
@apply bg-secondary/30 rounded-lg px-4 py-2 my-1 overflow-x-auto;
}
40 changes: 10 additions & 30 deletions src/lib/markdown/svelte-pages.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SvelteKit

Initialize a directory with `SvelteKit`

```sh
npm create svelte@latest
```
Expand All @@ -8,12 +10,16 @@ Also ensure `.svelte-kit` is added to `.gitignore`

## Static Adapter

Also install the staic adapter, which enables building the static site GitHub pages needs

```sh
npm i -D @sveltejs/adapter-static
```

## Modify svelte.config.js

Add the static adapter to `svelte.config.js` and set the options for the adapter

```js
import adapter from "@sveltejs/adapter-static";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
Expand All @@ -38,12 +44,16 @@ export default config;

## Add +layout.js

This is necessary to get the static site generation to work properly:

```js
export const prerender = true;
```

# If using tailwind:

I like using tailwind, and the steps to get it set up can be non-obvious:

## Install tailwind & friends

```sh
Expand Down Expand Up @@ -89,36 +99,6 @@ export default {
<style lang="postcss">
```
# Using colors w/ tailwind
## tailwind.config.js
```js
/** @type {import('tailwindcss').Config} */
export default {
content: ["./src/**/*.{html,js,ts,svelte}"],
theme: {
extend: {
strokeWidth: {
3: "3px",
},
},
colors: {
primary: "rgb(var(--color-primary) / <alpha-value>)",
secondary: "rgb(var(--color-secondary) / <alpha-value>)",
contrast: "rgb(var(--color-contrast) / <alpha-value>)",
"contrast-secondary":
"rgb(var(--color-contrast-secondary) / <alpha-value>)",
theme: "rgb(var(--color-theme) / <alpha-value>)",
white: "#ffffff",
black: "#000000",
},
},
plugins: [],
};
```
# Add .github/workflows/deploy.yml
```
Expand Down
8 changes: 5 additions & 3 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
<title>Ethan Ferguson</title>
</svelte:head>

<div class="theme-reset w-full h-screen flex flex-col overflow-auto absolute">
<header class="bg-primary p-1 z-50 hidden md:flex justify-between">
<div class="w-full h-screen flex flex-col overflow-auto absolute">
<header
class="theme-focus bg-primary p-1 z-50 hidden md:flex justify-between"
>
<h1 class="p-3">Ethan Ferguson</h1>
<DarkModeButton bind:checked={invert} />
</header>
<div class="sticky top-0 bg-secondary w-full z-40">
<div class="theme-focus sticky top-0 bg-secondary w-full z-40">
<PageMenu>
<h2 slot="title">Ethan Ferguson</h2>
<div
Expand Down
4 changes: 3 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<div class="flex flex-col gap-2 h-full max-w-4xl text-lg">
<div class="flex justify-between items-center emphasize pb-1">
<h1>About Me</h1>
<img src={personality} alt="Me" class="w-12 h-12 rounded-full" />
<a href="https://www.linkedin.com/in/ethan-ferguson-112011193/">
<img src={personality} alt="Me" class="w-12 h-12 rounded-full" />
</a>
</div>
<p>
I'm a Software Engineer at Jahnel Group. I studied CS and Cybersecurity at
Expand Down
1 change: 1 addition & 0 deletions src/routes/projects/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
How many Empire State Buildings would it take to reach the altitude of
the ISS?
</p>
<p>Try to guess the order of magnitude of absurd physics problems!</p>
</div>
</Project>
<Project
Expand Down
Loading

0 comments on commit 87f3eea

Please sign in to comment.