Skip to content

Commit bf7c6a3

Browse files
committed
some progress
1 parent 4895cf0 commit bf7c6a3

File tree

13 files changed

+467
-48
lines changed

13 files changed

+467
-48
lines changed

docs2/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"astro": "astro"
1111
},
1212
"dependencies": {
13+
"@astrojs/prism": "^3.1.0",
1314
"@astrojs/tailwind": "^5.1.2",
1415
"astro": "^4.16.12",
1516
"tailwindcss": "^3.4.14"

docs2/public/favicon.svg

Lines changed: 0 additions & 9 deletions
This file was deleted.
9.9 KB
Loading

docs2/public/images/favicon-16x16.png

717 Bytes
Loading

docs2/public/images/favicon-32x32.png

1.53 KB
Loading

docs2/src/components/CodeBlock.astro

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
import Code from '../icons/Code.astro';
3+
import { Prism } from '@astrojs/prism';
34
---
45
<div class="bg-gray-900 rounded-lg p-6 my-6">
56
{Astro.props.title && (
@@ -9,9 +10,9 @@ import Code from '../icons/Code.astro';
910
<span>{Astro.props.title}</span>
1011
</div>
1112
)}
12-
<pre class
13-
="overflow-x-auto p-4 bg-black/50 rounded-lg text-gray-300 font-mono text-sm">
14-
{Astro.props.code}
15-
</pre>
13+
<div class
14+
="overflow-x-auto p-4 bg-black/50 rounded-lg text-gray-300 font-mono text-lg">
15+
<Prism lang="js" code={Astro.props.code} />
16+
</div>
1617
</div>
1718

docs2/src/components/CommonHead.astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<meta charset="utf-8">
2+
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
3+
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png">
4+
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png">

docs2/src/pages/api/index.astro renamed to docs2/src/pages/docs/index.astro

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import BookOpen from '../../icons/BookOpen.astro';
44
import ChevronRight from '../../icons/ChevronRight.astro';
55
import Footer from '../../components/Footer.astro';
66
import Sidebar from '../../components/DocsSidebar.astro';
7+
import { Prism } from '@astrojs/prism';
8+
import '../../styles/base.css';
9+
import CommonHead from '../../components/CommonHead.astro';
710
811
//const [isSearchFocused, setIsSearchFocused] = React.useState(false);
912
@@ -50,7 +53,7 @@ idle: {
5053
<html lang="en">
5154
<head>
5255
<title>Robot Docs</title>
53-
<meta charset="utf-8">
56+
<CommonHead />
5457
</head>
5558
<body>
5659
<div class="min-h-screen bg-gradient-to-b from-purple-900 via-indigo-900 to-blue-900 text-gray-100">
@@ -116,9 +119,9 @@ idle: {
116119

117120
<div class="bg-gray-900 rounded-xl p-6 border-2 border-cyan-500 mb-8">
118121
<h2 class="font-mono text-xl text-cyan-400 mb-4">Basic Transition</h2>
119-
<pre class="bg-black/50 p-4 rounded-lg font-mono text-sm text-gray-300">
120-
{basicExample}
121-
</pre>
122+
<div class="bg-black/50 rounded-lg font-mono text-lg text-gray-300">
123+
<Prism lang="js" code={basicExample} />
124+
</div>
122125
</div>
123126

124127
<h2 class="font-mono text-2xl font-bold text-cyan-400 mb-4">Guards</h2>
@@ -127,9 +130,9 @@ idle: {
127130
</p>
128131

129132
<div class="bg-gray-900 rounded-xl p-6 border-2 border-cyan-500 mb-8">
130-
<pre class="font-mono text-sm text-gray-300">
131-
{guardExample}
132-
</pre>
133+
<div class="font-mono text-lg text-gray-300">
134+
<Prism lang="js" code={guardExample} />
135+
</div>
133136
</div>
134137

135138
<h2 class="font-mono text-2xl font-bold text-cyan-400 mb-4">Actions</h2>
@@ -138,9 +141,9 @@ idle: {
138141
</p>
139142

140143
<div class="bg-gray-900 rounded-xl p-6 border-2 border-cyan-500">
141-
<pre class="font-mono text-sm text-gray-300">
142-
{actionExample}
143-
</pre>
144+
<div class="font-mono text-lg text-gray-300">
145+
<Prism lang="js" code={actionExample} />
146+
</div>
144147
</div>
145148
</div>
146149
</main>

docs2/src/pages/index.astro

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,21 @@ import ArrowRight from '../icons/ArrowRight.astro';
1111
import Github from '../icons/GitHub.astro';
1212
import Terminal from '../icons/Terminal.astro';
1313
import BookOpen from '../icons/BookOpen.astro';
14+
import CommonHead from '../components/CommonHead.astro';
15+
import '../styles/base.css';
1416
---
1517

1618
<html lang="en">
1719
<head>
1820
<title>Robot</title>
19-
<meta charset="utf-8">
21+
<CommonHead />
2022
</head>
2123
<body>
2224
<div class="min-h-screen bg-gradient-to-b from-purple-900 via-indigo-900 to-blue-900 text-gray-100">
2325
<div class="absolute inset-0 overflow-hidden pointer-events-none">
2426
<div class="absolute inset-0 opacity-10">
2527
{[...Array(20)].map((_, i) => (
2628
<div
27-
key={i}
2829
class="absolute left-0 right-0 h-px bg-cyan-400"
2930
style={{
3031
top: `${i * 5}%`,
@@ -63,14 +64,14 @@ import BookOpen from '../icons/BookOpen.astro';
6364
</div>
6465

6566
<div class="flex gap-6 mt-8">
66-
<button class="group bg-cyan-500 hover:bg-cyan-400 text-black font-mono px-8 py-4 rounded-xl flex items-center gap-2 transform hover:scale-105 transition-all">
67+
<a href="/docs/" class="group bg-cyan-500 hover:bg-cyan-400 text-black font-mono px-8 py-4 rounded-xl flex items-center gap-2 transform hover:scale-105 transition-all">
6768
BOOT UP
6869
<ArrowRight class="group-hover:translate-x-1 transition-transform" />
69-
</button>
70-
<button class="group bg-gray-800 hover:bg-gray-700 font-mono px-8 py-4 rounded-xl flex items-center gap-2 border-2 border-cyan-500 transform hover:scale-105 transition-all">
70+
</a>
71+
<a href="https://github.com/matthewp/robot" class="group bg-gray-800 hover:bg-gray-700 font-mono px-8 py-4 rounded-xl flex items-center gap-2 border-2 border-cyan-500 transform hover:scale-105 transition-all">
7172
<Github />
7273
SOURCE_CODE
73-
</button>
74+
</a>
7475
</div>
7576
</div>
7677
</div>
@@ -143,25 +144,18 @@ import BookOpen from '../icons/BookOpen.astro';
143144

144145
<CodeBlock
145146
title="STATE_MACHINE.robot"
146-
code={`const titleMachine = createMachine({
147-
states: {
148-
viewing: {
149-
on: { EDIT: 'editing' }
150-
},
151-
editing: {
152-
on: {
153-
SAVE: 'saving',
154-
CANCEL: 'viewing'
155-
}
156-
},
157-
saving: {
158-
on: {
159-
SUCCESS: 'viewing',
160-
ERROR: 'editing'
161-
}
162-
}
163-
},
164-
initial: 'viewing'
147+
code={`const titleMachine = createMachine('viewing', {
148+
viewing: state({
149+
transition('edit', 'editing')
150+
}),
151+
editing: state({
152+
transition('save', 'saving'),
153+
transition('cancel', 'viewing')
154+
}),
155+
saving: state({
156+
transition('success', 'viewing'),
157+
transition('error', 'editing')
158+
})
165159
});`}
166160
/>
167161

docs2/src/styles/base.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@import "./prism-vsc-dark-plus.css";
2+
3+
.language-js {
4+
background: #080C13 !important;
5+
}

0 commit comments

Comments
 (0)