mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
back button
This commit is contained in:
1 parent
1f1c9f26f1
commit
ba1f530de7
5 files changed
+50
-5
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
.back {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
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) {
|
||||||
|
console.log("init");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(styles.back, className)}
|
||||||
|
onClick={(event) => {
|
||||||
|
console.log("back");
|
||||||
|
window.history.back();
|
||||||
|
onClick?.(event);
|
||||||
|
}}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -10,14 +10,14 @@
|
|||||||
border: none;
|
border: none;
|
||||||
|
|
||||||
font-family: var(--font-family-regular);
|
font-family: var(--font-family-regular);
|
||||||
font-size: 0.75em;
|
font-size: 0.8em;
|
||||||
color: var(--gray-1);
|
color: var(--gray-1);
|
||||||
font-weight: var(--weight-medium);
|
font-weight: var(--weight-medium);
|
||||||
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&[data-size="minor"] {
|
&[data-size="minor"] {
|
||||||
font-size: 0.75em;
|
font-size: 0.7em;
|
||||||
padding: var(--space-2) var(--space-3);
|
padding: var(--space-2) var(--space-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
&[data-variant="surface"],
|
&[data-variant="surface"],
|
||||||
&[data-variant="soft"] {
|
&[data-variant="soft"] {
|
||||||
background-color: var(--accent-3);
|
background-color: var(--accent-a3);
|
||||||
color: var(--gray-12);
|
color: var(--gray-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
---
|
---
|
||||||
|
import { ArrowLeftIcon } from "@radix-ui/react-icons";
|
||||||
import type { Tool } from "../constants/tools";
|
import type { Tool } from "../constants/tools";
|
||||||
import { getStrings } from "../core/i18n/getStrings";
|
import { getStrings } from "../core/i18n/getStrings";
|
||||||
|
import { Back } from "./Back";
|
||||||
|
import { Flex } from "./Flex";
|
||||||
import { Heading } from "./Heading";
|
import { Heading } from "./Heading";
|
||||||
|
import { IconButton } from "./IconButton";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
locale: string;
|
locale: string;
|
||||||
@@ -16,6 +20,8 @@ const toolStrings =
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
.tool-banner {
|
.tool-banner {
|
||||||
|
--tool-banner-overlap: 8rem;
|
||||||
|
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
@@ -40,11 +46,18 @@ const toolStrings =
|
|||||||
}
|
}
|
||||||
|
|
||||||
.centered {
|
.centered {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
max-width: var(--page-width);
|
max-width: var(--page-width);
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
|
.return {
|
||||||
|
width: 0.75em;
|
||||||
|
height: 0.75em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.pattern {
|
.pattern {
|
||||||
@@ -87,7 +100,15 @@ const toolStrings =
|
|||||||
|
|
||||||
<div class="centered">
|
<div class="centered">
|
||||||
<Heading weight="bold" size="2">
|
<Heading weight="bold" size="2">
|
||||||
{toolStrings.name}
|
<Flex align="center" gap="4">
|
||||||
|
<Back client:load>
|
||||||
|
<IconButton variant="soft" color="gray" highContrast>
|
||||||
|
<ArrowLeftIcon className="return" />
|
||||||
|
</IconButton>
|
||||||
|
</Back>
|
||||||
|
|
||||||
|
{toolStrings.name}
|
||||||
|
</Flex>
|
||||||
</Heading>
|
</Heading>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ const { accent, locale } = Astro.props;
|
|||||||
|
|
||||||
background-color: var(--gray-1);
|
background-color: var(--gray-1);
|
||||||
|
|
||||||
padding: var(--space-5);
|
padding: var(--space-4);
|
||||||
gap: var(--space-6);
|
gap: var(--space-6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user