mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-19 20:03:51 +01:00
tool banner and home
This commit is contained in:
6 files changed
+27
-46
No files matched your search
@@ -1,3 +0,0 @@
|
||||
.back {
|
||||
display: contents;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import type { ComponentProps } from "react";
|
||||
import { classNames } from "../../ui/classNames";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
interface Props extends ComponentProps<"div"> {}
|
||||
|
||||
export function Back({ className, onClick, ...props }: Props) {
|
||||
return (
|
||||
<div
|
||||
className={classNames(styles.back, className)}
|
||||
onClick={(event) => {
|
||||
console.log("back");
|
||||
window.history.back();
|
||||
onClick?.(event);
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
---
|
||||
import { ArrowLeftIcon } from "@radix-ui/react-icons";
|
||||
import { alias } from "@blitzkit/core";
|
||||
import { api } from "../api/dynamic";
|
||||
import type { Tool } from "../constants/tools";
|
||||
import { Logo } from "../icons/Logo";
|
||||
import { Back } from "./Back";
|
||||
import { Heading } from "./Heading";
|
||||
import { IconButton } from "./IconButton";
|
||||
|
||||
interface Props {
|
||||
locale: string;
|
||||
@@ -20,9 +18,21 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
<style>
|
||||
.tool-banner {
|
||||
--tool-banner-overlap: 8rem;
|
||||
--margin: var(--space-4);
|
||||
|
||||
flex: 1;
|
||||
border-radius: var(--space-4);
|
||||
overflow: hidden;
|
||||
|
||||
margin: var(--margin) var(--margin) 0 0;
|
||||
|
||||
background-size: cover;
|
||||
|
||||
@media screen and (max-width: 80rem) {
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@@ -31,7 +41,7 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: var(--space-4);
|
||||
padding: var(--space-5) var(--space-4);
|
||||
padding: var(--padding) var(--space-4);
|
||||
box-sizing: border-box;
|
||||
|
||||
backdrop-filter: var(--blur-tint);
|
||||
@@ -52,11 +62,6 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
flex: 1;
|
||||
max-width: var(--page-width);
|
||||
|
||||
.return {
|
||||
width: 0.75em;
|
||||
height: 0.75em;
|
||||
}
|
||||
|
||||
.logo {
|
||||
position: absolute;
|
||||
|
||||
@@ -98,7 +103,7 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
<div
|
||||
class="tool-banner"
|
||||
style={{
|
||||
backgroundImage: `url(/media/tools/banners/${tool.id}.webp)`,
|
||||
backgroundImage: `url(${alias("api", `/tools/${tool.id}/banners/thumbnail.webp`)})`,
|
||||
backgroundPosition: tool.banner_background_position ?? "top",
|
||||
}}
|
||||
>
|
||||
@@ -106,20 +111,11 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
<div
|
||||
class="pattern"
|
||||
style={{ backgroundImage: `url(/media/patterns/${tool.id}.svg)` }}
|
||||
>
|
||||
</div>
|
||||
></div>
|
||||
|
||||
<div class="centered">
|
||||
<Heading weight="bold" size="2">
|
||||
<div style={{ display: "flex", alignItems: "center", gap: "var(--space-4)" }}>
|
||||
<Back client:load>
|
||||
<IconButton variant="soft" color="gray" highContrast>
|
||||
<ArrowLeftIcon className="return" />
|
||||
</IconButton>
|
||||
</Back>
|
||||
|
||||
{toolStrings.name}
|
||||
</div>
|
||||
{toolStrings.name}
|
||||
</Heading>
|
||||
|
||||
<Logo className="logo" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
import { alias } from "@blitzkit/core";
|
||||
import { api } from "../api/dynamic";
|
||||
import type { Tool } from "../constants/tools";
|
||||
import { Heading } from "./Heading";
|
||||
@@ -79,7 +80,9 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
</style>
|
||||
|
||||
<div
|
||||
style={{ backgroundImage: `url(/media/tools/banners/${tool.id}.webp)` }}
|
||||
style={{
|
||||
backgroundImage: `url(${alias("api", `/tools/${tool.id}/banners/poster.webp`)})`,
|
||||
}}
|
||||
class="container"
|
||||
data-disabled={String(tool.disabled ?? false)}
|
||||
>
|
||||
@@ -92,7 +95,9 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
>
|
||||
<div
|
||||
class="background"
|
||||
style={{ backgroundImage: `url(/media/tools/banners/${tool.id}.webp)` }}
|
||||
style={{
|
||||
backgroundImage: `url(${alias("api", `/tools/${tool.id}/banners/poster.webp`)})`,
|
||||
}}
|
||||
></div>
|
||||
|
||||
<div class="content" data-minor={minor}>
|
||||
|
||||
@@ -96,10 +96,12 @@ export const tools: Record<string, Tool> = {
|
||||
|
||||
export enum ToolBannerSize {
|
||||
Thumbnail = "thumbnail",
|
||||
Poster = "poster",
|
||||
Full = "full",
|
||||
}
|
||||
|
||||
export const TOOL_BANNER_HEIGHTS: Record<ToolBannerSize, number | null> = {
|
||||
[ToolBannerSize.Thumbnail]: 128,
|
||||
[ToolBannerSize.Poster]: 480 * 1.5,
|
||||
[ToolBannerSize.Full]: null,
|
||||
};
|
||||
@@ -16,7 +16,7 @@ const { locale } = Astro.props;
|
||||
<ColorScale color="amber" />
|
||||
<ColorScale color="red" />
|
||||
|
||||
<ToolBanner {locale} tool={tools.tanks} slot="pre-app" />
|
||||
<ToolBanner {locale} tool={tools.tanks} />
|
||||
|
||||
<Section>
|
||||
<Page {locale} client:only="react">
|
||||
|
||||
Reference in new issue
Block a user