Skip to content

Commit

Permalink
feat: rewrite docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lino-levan committed Aug 22, 2023
1 parent c235ed5 commit 65b3f80
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 13 deletions.
7 changes: 6 additions & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"tasks": {
// The task to automatically generate `./src/celestial.ts`
"bind": "deno run -A ./bindings/_tools/generate/mod.ts && deno fmt",
"test": "deno test -A --trace-ops"
"test": "deno test -A --trace-ops",
"www": "cd docs && pyro dev"
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "https://esm.sh/[email protected]"
}
}
7 changes: 6 additions & 1 deletion deno.lock

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

2 changes: 1 addition & 1 deletion docs/pages/advanced/binary.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 3.1 - Binaries
title: Binaries
description: How Astral deals with binaries
index: 0
---
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/advanced/bindings.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 2.2 - Bindings
title: Bindings
description: How Astral generates bindings
index: 1
---
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/advanced/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 3 - Advanced
title: Advanced
description: Advanced topics for Astral
index: 2
---
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/advanced/polish.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 3.3 - Polish
title: Polish
description: How Astral finalizes the polish to make a usable API.
index: 2
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 2.3 - Evaluate
title: Evaluate
description: A small example on how to do complex evaluation in Astral
index: 1
index: 2
---

## Running
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/examples/index.md → docs/pages/guides/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 2 - Examples
description: Small examples for Astral
title: Guides
description: Small guides for Astral
index: 1
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 2.2 - Navigation
title: Navigation
description: A small example on how to do complex navigation in Astral
index: 1
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 2.1 - Screenshots
title: Screenshots
description: A small example on how to do screenshots in Astral
index: 0
---
Expand Down
4 changes: 3 additions & 1 deletion docs/pages/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 1 - Astral
title: Introduction
description: A simple introduction to Astral
index: 0
---
Expand All @@ -19,6 +19,8 @@ Here are a few examples to get you started:
- Automate form submission, UI testing, keyboard input, etc.
- Create a reproducable, automated testing environment using the latest
JavaScript and browser features.
- Stealthy by default. No need to install or setup extra libraries to get
features that should come by default.

## Usage

Expand Down
88 changes: 88 additions & 0 deletions docs/pages/showcase.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { ensureDirSync } from "https://deno.land/[email protected]/fs/ensure_dir.ts";
import { launch } from "../../mod.ts";
import { type PageProps } from "https://deno.land/x/[email protected]/page.ts";
import { ensureFileSync } from "https://deno.land/[email protected]/fs/ensure_file.ts";

export const config = {
title: "Showcase",
description: "A small showcase for projects that use Astral!",
};

interface Project {
title: string;
description: string;
source: string;
}

const projects: Project[] = [
{
title: "Manuscript Marauder",
description: "Download manuscripts using a proxy",
source: "https://github.com/rnbguy/manuscript-marauder",
},
];

export default function Page(props: PageProps) {
return (
<div class="flex flex-col items-center min-h-screen bg-white dark:bg-dark dark:text-white">
{props.header}
<div class="flex-grow py-8 w-full flex flex-col items-center">
<div class="text-center flex flex-col items-center gap-4">
<h2 class="font-bold text-3xl">Astral Project Showcase</h2>
<p class="text-gray-500 dark:text-gray-400">
List of projects people are building with Astral
</p>
<a
class="rounded px-8 py-2 bg-purple-500 text-white w-max font-semibold text-sm"
href="https://github.com/lino-levan/astral/issues/new"
>
🙏 Please add your project
</a>
</div>
<div class="max-w-screen-xl pt-8 px-8 flex flex-wrap gap-8 justify-center">
{projects.map((project) => (
<div class="w-72 bg-white dark:bg-black shadow-lg rounded-lg overflow-hidden">
<a href={project.source}>
<img
class="w-full h-36"
src={`/showcase${new URL(project.source).pathname}.png`}
/>
</a>
<div class="p-4 border-t-2 dark:border-gray-500">
<a
href={project.source}
class="text-purple-600 dark:text-purple-500 font-semibold hover:underline"
>
{project.title}
</a>
<p class="text-gray-800 dark:text-gray-300">
{project.description}
</p>
</div>
</div>
))}
</div>
</div>
{props.footer}
</div>
);
}

// let's boot astral and download some stuff :)
if (import.meta.main) {
const browser = await launch();
const page = await browser.newPage();

for (const project of projects) {
await page.goto(project.source);
const screenshot = await page.screenshot();
const path = `./docs/static/showcase${
new URL(project.source).pathname
}.png`;
ensureFileSync(path);

Deno.writeFileSync(path, screenshot);
}

await browser.close();
}
4 changes: 4 additions & 0 deletions docs/pyro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ github: https://github.com/lino-levan/astral
copyright: |-
Copyright © 2023 Lino Le Van
MIT Licensed
header:
left:
- Docs /
- Showcase /showcase
footer:
Learn:
- Introduction /
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 65b3f80

Please sign in to comment.