-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
427 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { createSignal } from "solid-js"; | ||
import { Guide } from "./Guide"; | ||
import { doClickActionState } from "./lib/action"; | ||
import { CONTENT } from "./lib/content"; | ||
import { Guide } from "./modes/guide/Guide"; | ||
import { CONTENT } from "$lib/content"; | ||
import { lazy, Match, Suspense, Switch } from "solid-js"; | ||
|
||
interface AppState { | ||
stepHistory: string[]; | ||
} | ||
const Editor = lazy(() => | ||
import("./modes/editor/Editor").then((m) => ({ default: m.Editor })) | ||
); | ||
|
||
export function App() { | ||
const initialStep = window.location.hash.slice(1) || "start"; | ||
|
||
const [state, setState] = createSignal<AppState>({ | ||
stepHistory: [initialStep], | ||
}); | ||
const editorMode = window.location.search.slice(1) == "editor"; | ||
const initialStep = window.location.hash.slice(1); | ||
|
||
return ( | ||
<Guide | ||
content={CONTENT} | ||
stepHistory={state().stepHistory} | ||
onAction={(step) => setState(doClickActionState(state(), { step }))} | ||
/> | ||
<Switch fallback={<Guide content={CONTENT} initialStep={initialStep} />}> | ||
<Match when={editorMode}> | ||
<Suspense fallback={<p>Loading...</p>}> | ||
<Editor /> | ||
</Suspense> | ||
</Match> | ||
</Switch> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,81 @@ | ||
:root { | ||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; | ||
line-height: 1.5; | ||
font-weight: 400; | ||
@layer base { | ||
:root { | ||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; | ||
line-height: 1.5; | ||
font-weight: 400; | ||
|
||
color-scheme: only dark; | ||
color: rgba(255, 255, 255, 0.87); | ||
background-color: #242424; | ||
color-scheme: only dark; | ||
color: rgba(255, 255, 255, 0.87); | ||
background-color: #242424; | ||
|
||
font-synthesis: none; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
font-synthesis: none; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
#root { | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
} | ||
body { | ||
margin: 0; | ||
display: flex; | ||
width: 100%; | ||
min-height: 100vh; | ||
height: 100%; | ||
} | ||
|
||
a { | ||
font-weight: 500; | ||
color: #646cff; | ||
text-decoration: inherit; | ||
} | ||
a:hover { | ||
color: #535bf2; | ||
} | ||
h1 { | ||
font-size: 1.5em; | ||
line-height: 1.1; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
display: flex; | ||
} | ||
a { | ||
font-weight: 500; | ||
color: #646cff; | ||
text-decoration: inherit; | ||
} | ||
a:hover { | ||
color: #535bf2; | ||
} | ||
|
||
h1 { | ||
font-size: 1.5em; | ||
line-height: 1.1; | ||
} | ||
button { | ||
border-radius: 8px; | ||
border: 1px solid transparent; | ||
padding: 0.6em 1.2em; | ||
font-size: 1em; | ||
font-weight: 500; | ||
font-family: inherit; | ||
background-color: #1a1a1a; | ||
cursor: pointer; | ||
transition: border-color 0.25s, background 0.25s; | ||
} | ||
button:hover { | ||
border-color: #f3e600; | ||
} | ||
button:focus, | ||
button:focus-visible { | ||
outline: 4px auto -webkit-focus-ring-color; | ||
} | ||
|
||
.container { | ||
max-width: 80ch; | ||
button:active { | ||
background-color: #000000; | ||
} | ||
} | ||
|
||
/* Fix lists lmao */ | ||
.step-description * * { | ||
text-align: left; | ||
} | ||
#root { | ||
display: flex; | ||
flex-direction: column; | ||
flex-grow: 1; | ||
|
||
button { | ||
border-radius: 8px; | ||
border: 1px solid transparent; | ||
padding: 0.6em 1.2em; | ||
font-size: 1em; | ||
font-weight: 500; | ||
font-family: inherit; | ||
background-color: #1a1a1a; | ||
cursor: pointer; | ||
transition: border-color 0.25s, background 0.25s; | ||
} | ||
button:hover { | ||
border-color: #f3e600; | ||
} | ||
button:focus, | ||
button:focus-visible { | ||
outline: 4px auto -webkit-focus-ring-color; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
button:active { | ||
background-color: #000000; | ||
} | ||
@layer utils { | ||
.button-list { | ||
display: inline-grid; | ||
gap: 0.5rem; | ||
} | ||
|
||
.button-list { | ||
display: inline-grid; | ||
gap: 0.5rem; | ||
.container { | ||
max-width: 80ch; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { EditorView, basicSetup } from "codemirror"; | ||
import { onCleanup } from "solid-js"; | ||
import { yaml } from "@codemirror/lang-yaml"; | ||
import { indentWithTab } from "@codemirror/commands"; | ||
import { oneDark } from "@codemirror/theme-one-dark"; | ||
import { keymap } from "@codemirror/view"; | ||
import { customLinter } from "./linter"; | ||
import { lintGutter } from "@codemirror/lint"; | ||
|
||
export interface CodeMirrorProps { | ||
content?: string; | ||
} | ||
|
||
export function CodeMirror(props: CodeMirrorProps) { | ||
let view = new EditorView({ | ||
doc: props.content, | ||
extensions: [ | ||
basicSetup, | ||
oneDark, | ||
yaml(), | ||
customLinter, | ||
lintGutter(), | ||
keymap.of([indentWithTab]), | ||
], | ||
}); | ||
|
||
onCleanup(() => view.destroy()); | ||
|
||
return <>{view.dom}</>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import contentRaw from "$content/guide.yaml?raw"; | ||
import { CodeMirror } from "./CodeMirror"; | ||
|
||
import "./editor.css"; | ||
|
||
export function Editor() { | ||
return ( | ||
<div id="editor"> | ||
<CodeMirror content={contentRaw} /> | ||
<div>E</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
body { | ||
overflow: hidden; | ||
} | ||
|
||
#editor { | ||
flex-grow: 1; | ||
|
||
width: 100vw; | ||
height: 100vh; | ||
|
||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
} | ||
|
||
.cm-editor { | ||
max-width: 100%; | ||
max-height: 100%; | ||
overflow: auto; | ||
scrollbar: overlay; | ||
} |
Oops, something went wrong.