Skip to content

Commit 9231dc9

Browse files
committed
feat: marketing page
1 parent 6dbcd59 commit 9231dc9

17 files changed

+250
-17
lines changed

bun.lock

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"fuse.js": "^7.1.0",
2020
"instantsearch.js": "^4.78.0",
2121
"minisearch": "^7.1.2",
22+
"motion": "^12.5.0",
2223
"reka-ui": "^2.1.0",
2324
"tailwindcss": "^4.0.14",
2425
"typescript": "^5.8.2",
@@ -585,6 +586,8 @@
585586

586587
"flatted": ["[email protected]", "", {}, "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg=="],
587588

589+
"framer-motion": ["[email protected]", "", { "dependencies": { "motion-dom": "^12.5.0", "motion-utils": "^12.5.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-buPlioFbH9/W7rDzYh1C09AuZHAk2D1xTA1BlounJ2Rb9aRg84OXexP0GLd+R83v0khURdMX7b5MKnGTaSg5iA=="],
590+
588591
"fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
589592

590593
"function-bind": ["[email protected]", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
@@ -751,6 +754,12 @@
751754

752755
"mlly": ["[email protected]", "", { "dependencies": { "acorn": "^8.14.0", "pathe": "^2.0.1", "pkg-types": "^1.3.0", "ufo": "^1.5.4" } }, "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw=="],
753756

757+
"motion": ["[email protected]", "", { "dependencies": { "framer-motion": "^12.5.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-BTAYKszMmTvXSsIyeHNMPSicjWgUA4j7OmZv1xPpthm4sPub3ch66fy9U7BhJ1uXNL3YeprsIegzuvps3FkEMw=="],
758+
759+
"motion-dom": ["[email protected]", "", { "dependencies": { "motion-utils": "^12.5.0" } }, "sha512-uH2PETDh7m+Hjd1UQQ56yHqwn83SAwNjimNPE/kC+Kds0t4Yh7+29rfo5wezVFpPOv57U4IuWved5d1x0kNhbQ=="],
760+
761+
"motion-utils": ["[email protected]", "", {}, "sha512-+hFFzvimn0sBMP9iPxBa9OtRX35ZQ3py0UHnb8U29VD+d8lQ8zH3dTygJWqK7av2v6yhg7scj9iZuvTS0f4+SA=="],
762+
754763
"ms": ["[email protected]", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
755764

756765
"nanoid": ["[email protected]", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-SppoicMGpZvbF1l3z4x7No3OlIjP7QJvC9XR7AhZr1kL133KHnKPztkKDc+Ir4aJ/1VhTySrtKhrsycmrMQfvg=="],

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"fuse.js": "^7.1.0",
2222
"instantsearch.js": "^4.78.0",
2323
"minisearch": "^7.1.2",
24+
"motion": "^12.5.0",
2425
"reka-ui": "^2.1.0",
2526
"tailwindcss": "^4.0.14",
2627
"typescript": "^5.8.2",

src/Web/Homepage/HomeController.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,31 @@
22

33
namespace App\Web\Homepage;
44

5+
use League\CommonMark\MarkdownConverter;
56
use Tempest\Router\Get;
67
use Tempest\Router\StaticPage;
78
use Tempest\View\View;
89

10+
use function Tempest\Support\Arr\map_with_keys;
11+
use function Tempest\Support\Str\before_last;
12+
use function Tempest\Support\Str\strip_end;
913
use function Tempest\view;
1014

1115
final readonly class HomeController
1216
{
17+
public function __construct(
18+
private MarkdownConverter $markdown,
19+
) {
20+
}
21+
1322
#[StaticPage]
1423
#[Get('/')]
1524
public function __invoke(): View
1625
{
17-
return view('./home.view.php');
26+
$codeBlocks = map_with_keys(glob(__DIR__ . '/codeblocks/*.md'), function (string $path) {
27+
return yield strip_end(basename($path), '.md') => $this->markdown->convert(file_get_contents($path));
28+
});
29+
30+
return view('./home.view.php', codeBlocks: $codeBlocks);
1831
}
1932
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
```php src/config/database.config.php
2+
use Tempest\Database\Config\PostgresConfig;
3+
use function Tempest\env;
4+
5+
return new PostgresConfig(
6+
host: env('DB_HOST'),
7+
port: env('DB_PORT'),
8+
username: env('DB_USERNAME'),
9+
password: env('DB_PASSWORD'),
10+
database: env('DB_DATABASE'),
11+
);
12+
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
```php src/Books/BookController.php
2+
final readonly class BookController
3+
{
4+
// …
5+
6+
#[Post('/books')]
7+
public function store(CreateBookRequest $request): Response
8+
{
9+
$book = map($request)->to(Book::class)->save();
10+
11+
return new Redirect([self::class, 'show'], book: $book->id);
12+
}
13+
}
14+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```php
2+
use function Tempest\map;
3+
4+
map('path/to/books.json')->collection->to(Book::class);
5+
6+
map($book)->to(MapTo::JSON);
7+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
```php src/Support/MarkdownInitializer.php
2+
final readonly class MarkdownInitializer implements Initializer
3+
{
4+
public function initialize(Container $container): MarkdownConverter
5+
{
6+
$environment = new Environment();
7+
$highlighter = (new Highlighter(new CssTheme()));
8+
9+
$highlighter
10+
->addLanguage(new TempestViewLanguage())
11+
->addLanguage(new TempestConsoleWebLanguage())
12+
->addLanguage(new ExtendedJsonLanguage());
13+
14+
$environment
15+
->addExtension(new CommonMarkCoreExtension())
16+
->addExtension(new FrontMatterExtension())
17+
->addRenderer(FencedCode::class, new CodeBlockRenderer($highlighter))
18+
->addRenderer(Code::class, new InlineCodeBlockRenderer($highlighter));
19+
20+
return new MarkdownConverter($environment);
21+
}
22+
}
23+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
```php src/Books/Book.php
2+
final class Book implements DatabaseModel
3+
{
4+
use IsDatabaseModel;
5+
6+
public function __construct(
7+
#[Length(min: 1, max: 120)]
8+
public string $title,
9+
10+
public ?Author $author = null,
11+
12+
/** @var \App\Books\Chapter[] */
13+
public array $chapters = [],
14+
) {}
15+
}
16+
```

src/Web/Homepage/codeblocks/orm.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
```php
2+
$books = Book::query()
3+
->with('author.publisher')
4+
->where('createdAt < :olderThan', olderThan: $olderThan)
5+
->orderBy('createdAt DESC')
6+
->limit(5)
7+
->all();
8+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
```html x-base.view.php
2+
<!DOCTYPE html>
3+
<html lang="en" class="h-dvh flex flex-col">
4+
<head>
5+
<title :if="isset($title)">{{ $title }} — Bookish</title>
6+
<title :else>Bookish</title>
7+
<meta charset="UTF-8" />
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
9+
<x-vite-tags />
10+
<x-slot name="head" />
11+
</head>
12+
<body class="antialiased flex flex-col grow">
13+
<x-slot />
14+
<x-slot name="scripts" />
15+
</body>
16+
</html>
17+
```

0 commit comments

Comments
 (0)