Skip to content

Commit 730d570

Browse files
committed
Small improvement to the homepage and code page
1 parent d650c92 commit 730d570

File tree

4 files changed

+59
-117
lines changed

4 files changed

+59
-117
lines changed

src/Web/Code/code.view.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
</style>
1818
</x-slot>
1919

20-
<div class="hero-bg h-full flex items-center justify-center">
21-
<form action="<?= uri([CodeController::class, 'submit']) ?>" method="POST" class="w-full">
20+
<div class="hero-bg h-full flex justify-center">
21+
<x-form :action="uri([CodeController::class, 'submit'])" class="w-full">
2222
<div class="grid gap-4 max-full max-w-[66%] mx-auto">
2323
<input type="hidden" name="lang" :value="$language">
24-
<label for="code" class="text-xl text-white">Paste your code</label>
24+
<label for="code" class="text-xl">Paste your code</label>
2525
<textarea name="code" id="code" class="border-2 border-[--primary] w-full p-4 rounded bg-[var(--code-background)] text-[var(--foreground)]" rows="20" autofocus>{{ $code }}</textarea>
2626
<div class="flex justify-end">
27-
<input type="submit" name="Generate" class="bg-[var(--link-color)] text-white font-bold p-4 py-3 hover:bg-[var(--link-hover-color)] rounded cursor-pointer"/>
27+
<input type="submit" class="no-primary rounded-md font-medium inline-flex items-center focus:outline-hidden disabled:cursor-not-allowed aria-disabled:cursor-not-allowed disabled:opacity-75 aria-disabled:opacity-75 transition-colors px-4 py-2 gap-2 ring ring-inset ring-(--ui-border-accented) text-(--ui-text) bg-(--ui-bg) hover:bg-(--ui-bg-elevated) disabled:bg-(--ui-bg) aria-disabled:bg-(--ui-bg) focus-visible:ring-2 focus-visible:ring-(--ui-border-inverted)"></input>
2828
</div>
2929
</div>
30-
</form>
30+
</x-form>
3131
</div>
3232
</x-base>

src/Web/Code/code_preview.view.php

Lines changed: 5 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,5 @@
11
<x-base>
2-
3-
<x-slot name="scripts">
4-
<script src="/html2canvas.min.js" defer></script>
5-
<script src="/filesaver.min.js" defer></script>
6-
7-
<script>
8-
const makeScreenshot = document.getElementById('make-screenshot');
9-
10-
makeScreenshot.addEventListener('click', (e) => {
11-
e.preventDefault();
12-
e.stopPropagation();
13-
14-
let screenshot = document.getElementById("screenshot");
15-
screenshot.classList.add('hero-bg-screenshot');
16-
html2canvas(screenshot, {
17-
allowTaint: true,
18-
useCORS: true,
19-
scale: 4,
20-
})
21-
.then(function (canvas) {
22-
screenshot.classList.remove('hero-bg-screenshot');
23-
canvas.toBlob(function (blob) {
24-
const date = new Date;
25-
26-
const timestamp = date.getFullYear() + '-' + date.getMonth() + '-' + date.getDay() + '_' + date.getHours() + '-' + date.getMinutes() + '-' + date.getSeconds();
27-
28-
saveAs(blob, "screenshot-" + timestamp + ".png");
29-
});
30-
})
31-
.catch((e) => {
32-
screenshot.classList.remove('hero-bg-screenshot');
33-
});
34-
35-
36-
});
37-
</script>
38-
</x-slot>
2+
<x-aurora class="dark:hidden"/>
393

404
<div class="bg-red p-4 fixed z-[99] right-0 top-0 flex gap-2">
415
<a
@@ -48,37 +12,17 @@ class="
4812
shadow-xl
4913
border-2 border-transparent
5014
hover:bg-tempest-blue-500
51-
hover:text-white
5215
hover:border-white
5316
">
5417
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
55-
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
18+
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"/>
5619
</svg>
5720
</a>
58-
<button
59-
id="make-screenshot"
60-
class="
61-
bg-white
62-
p-2
63-
rounded-full
64-
shadow-xl
65-
border-2 border-transparent
66-
hover:bg-tempest-blue-500
67-
hover:text-white
68-
hover:border-white
69-
">
70-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
71-
<path stroke-linecap="round" stroke-linejoin="round" d="M6.827 6.175A2.31 2.31 0 0 1 5.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 0 0-1.134-.175 2.31 2.31 0 0 1-1.64-1.055l-.822-1.316a2.192 2.192 0 0 0-1.736-1.039 48.774 48.774 0 0 0-5.232 0 2.192 2.192 0 0 0-1.736 1.039l-.821 1.316Z"/>
72-
<path stroke-linecap="round" stroke-linejoin="round" d="M16.5 12.75a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0ZM18.75 10.5h.008v.008h-.008V10.5Z"/>
73-
</svg>
74-
</button>
7521
</div>
7622

77-
<div class="hero-bg h-full flex items-center justify-center">
78-
<div class="p-12" id="screenshot" >
79-
<x-codeblock-home class="max-h-[80%]">
80-
<pre data-lang="<?= $language ?>"><?= $code ?></pre>
81-
</x-codeblock-home>
23+
<div class="flex items-center justify-center h-full absolute top-0 left-0 w-full">
24+
<div class="bg-(--ui-bg) border border-(--ui-border) rounded-md p-8 max-h-[75%] overflow-scroll" id="screenshot">
25+
<pre data-lang="<?= $language ?>"><?= $code ?></pre>
8226
</div>
8327
</div>
8428

src/Web/Homepage/home.view.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
<span class="text-(--ui-primary)">gets out of your way.</span>
2727
</h1>
2828
<p class="mt-4 md:mt-6 xl:mt-8 max-w-xl text-xl xl:text-2xl text-(--ui-text-toned)">
29-
Tempest embraces modern PHP syntax and covers a wide range of features, giving you all the tools you need to <span class="font-bold">focus on your code</span>.
29+
Tempest embraces modern PHP and covers a wide range of features, giving you all the tools you need to <span class="font-bold">focus on your code</span>.
3030
</p>
3131
<div class="mt-6 md:mt-8 xl:mt-10 flex gap-4 items-center font-medium text-lg justify-center md:justify-start">
3232
<a :href="uri([ChapterController::class, 'index'])" class="bg-(--ui-bg-inverted) text-(--ui-bg) hover:bg-(--ui-bg-inverted)/90 rounded-xl px-6 py-2.5 gap-1.5 transition">
3333
Get started
3434
</a>
35-
<a :href="uri([RedirectsController::class, 'github'])" class="hidden md:flex text(--ui-text) hover:bg-(--ui-info)/10 group rounded-xl px-6 py-2.5 flex items-center gap-x-1.5 transition">
35+
<a :href="uri([RedirectsController::class, 'github'])" class="hidden md:flex text(--ui-text) hover:bg-(--ui-info)/10 group rounded-xl px-6 py-2.5 flex items-center gap-x-1.5 transition border border-(--ui-border)">
3636
<x-icon name="tabler:brand-github" class="size-6" />
3737
Source code
3838
<svg class="group-hover:translate-x-0 size-5 scale-85 group-hover:scale-100 transition opacity-0 group-hover:opacity-100 -translate-x-full" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">

src/Web/x-base.view.php

Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,71 @@
1-
<x-component name="x-base">
2-
<html lang="en" class="h-dvh flex flex-col">
3-
<head>
1+
<html lang="en" class="h-dvh flex flex-col">
2+
<head>
43
<title :if="isset($fullTitle)">{{ $fullTitle }}</title>
54
<title :elseif="isset($title)">{{ $title }} — Tempest</title>
65
<title :else>Tempest</title>
76

8-
<meta charset="UTF-8" />
9-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<meta charset="UTF-8"/>
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
109

1110
<!-- Current meta image -->
1211
<?php
1312
$metaImageUri ??= ($meta ?? \App\Web\Meta\MetaType::HOME)->uri();
1413
?>
1514

1615
<!-- Social -->
17-
<meta property="og:image" content="<?= $metaImageUri ?>" />
18-
<meta property="twitter:image" content="<?= $metaImageUri ?>" />
19-
<meta name="image" content="<?= $metaImageUri ?>" />
20-
<meta name="twitter:card" content="summary_large_image" />
16+
<meta property="og:image" content="<?= $metaImageUri ?>"/>
17+
<meta property="twitter:image" content="<?= $metaImageUri ?>"/>
18+
<meta name="image" content="<?= $metaImageUri ?>"/>
19+
<meta name="twitter:card" content="summary_large_image"/>
2120

2221
<!-- Favicon -->
23-
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png" />
24-
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png" />
25-
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png" />
26-
<link rel="manifest" href="/favicon/site.webmanifest" />
22+
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png"/>
23+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png"/>
24+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png"/>
25+
<link rel="manifest" href="/favicon/site.webmanifest"/>
2726

2827
<!-- Vite tags -->
29-
<x-vite-tags />
28+
<x-vite-tags/>
3029

3130
<!-- Dark mode -->
3231
<script>
33-
function isDark() {
34-
return localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)
35-
}
36-
37-
function applyTheme(theme = undefined) {
38-
if (theme) {
39-
localStorage.theme = theme
32+
function isDark() {
33+
return localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)
4034
}
4135

42-
document.documentElement.classList.toggle('dark', isDark())
43-
document.dispatchEvent(new CustomEvent('theme-changed', { detail: { isDark: isDark() }}))
44-
}
36+
function applyTheme(theme = undefined) {
37+
if (theme) {
38+
localStorage.theme = theme
39+
}
40+
41+
document.documentElement.classList.toggle('dark', isDark())
42+
document.dispatchEvent(new CustomEvent('theme-changed', {detail: {isDark: isDark()}}))
43+
}
4544

46-
function toggleDarkMode() {
47-
applyTheme(isDark() ? 'light' : 'dark')
48-
}
45+
function toggleDarkMode() {
46+
applyTheme(isDark() ? 'light' : 'dark')
47+
}
4948

50-
applyTheme()
49+
applyTheme()
5150
</script>
5251

53-
<x-slot name="head" />
54-
</head>
55-
<body :class="trim(($bodyClass ?? '') . ' relative antialiased flex flex-col grow')">
56-
<div class="absolute pointer-events-none inset-0 bg-repeat" style="background-image: url(/noise.svg)">
57-
<div id="command-palette"></div>
58-
</div>
59-
<x-header :stargazers="$stargazers" />
60-
<x-slot />
61-
<x-footer />
62-
<x-slot name="scripts" />
63-
<x-template :if="$copyCodeBlocks ?? false">
64-
<template id="copy-template">
65-
<button class="absolute group top-2 right-2 size-7 flex items-center justify-center cursor-pointer opacity-0 group-hover:opacity-100 transition text-(--ui-text-dimmed) bg-(--ui-bg-muted) rounded border border-(--ui-border) hover:text-(--ui-text-highlighted)">
66-
<x-icon name="tabler:copy" class="size-5 absolute" />
67-
<x-icon name="tabler:copy-check-filled" class="size-5 absolute opacity-0 group-[[data-copied]]:opacity-100 transition" />
68-
</button>
69-
</template>
70-
</x-template>
71-
</body>
72-
</html>
73-
</x-component>
52+
<x-slot name="head"/>
53+
</head>
54+
<body :class="trim(($bodyClass ?? '') . ' relative antialiased flex flex-col grow')">
55+
<div class="absolute pointer-events-none inset-0 bg-repeat" style="background-image: url(/noise.svg)">
56+
<div id="command-palette"></div>
57+
</div>
58+
<x-header :stargazers="$stargazers"/>
59+
<x-slot/>
60+
<x-footer/>
61+
<x-slot name="scripts"/>
62+
<x-template :if="$copyCodeBlocks ?? false">
63+
<template id="copy-template">
64+
<button class="absolute group top-2 right-2 size-7 flex items-center justify-center cursor-pointer opacity-0 group-hover:opacity-100 transition text-(--ui-text-dimmed) bg-(--ui-bg-muted) rounded border border-(--ui-border) hover:text-(--ui-text-highlighted)">
65+
<x-icon name="tabler:copy" class="size-5 absolute"/>
66+
<x-icon name="tabler:copy-check-filled" class="size-5 absolute opacity-0 group-[[data-copied]]:opacity-100 transition"/>
67+
</button>
68+
</template>
69+
</x-template>
70+
</body>
71+
</html>

0 commit comments

Comments
 (0)