mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-17 10:53:57 +01:00
feat: search
This commit is contained in:
1 parent
385cc3b6d2
commit
d6e37119a8
12 files changed
+98
-17
No files matched your search
@@ -43,13 +43,14 @@ import "@fontsource-variable/roboto-flex";
|
||||
--weight-bold: 700;
|
||||
--weight-black: 900;
|
||||
|
||||
--outline-interactive: var(--space-1) solid var(--gray-4);
|
||||
--outline-focus: var(--space-1) solid var(--accent-6);
|
||||
|
||||
--shadow-cavity:
|
||||
/* --shadow-cavity:
|
||||
inset calc(var(--space-1) * sin(45deg)) calc(var(--space-1) * sin(45deg))
|
||||
var(--space-1) var(--black-a3),
|
||||
inset calc(var(--space-1) * sin(45deg) * -1)
|
||||
calc(var(--space-1) * sin(45deg) * -1) var(--space-1) var(--white-a1);
|
||||
calc(var(--space-1) * sin(45deg) * -1) var(--space-1) var(--white-a1); */
|
||||
|
||||
--shadow-bump:
|
||||
inset calc(var(--space-1) * sin(45deg)) calc(var(--space-1) * sin(45deg))
|
||||
@@ -60,7 +61,7 @@ import "@fontsource-variable/roboto-flex";
|
||||
--shadow-outline-width: 1.5px;
|
||||
--shadow-outline-width-negative: calc(var(--shadow-outline-width) * -1);
|
||||
|
||||
--shadow-interactive-background: 0 0 0 var(--shadow-outline-width)
|
||||
/* --shadow-interactive-background: 0 0 0 var(--shadow-outline-width)
|
||||
var(--gray-6);
|
||||
--shadow-interactive-shine: var(--shadow-outline-width-negative)
|
||||
var(--shadow-outline-width-negative) var(--shadow-outline-width)
|
||||
@@ -69,7 +70,7 @@ import "@fontsource-variable/roboto-flex";
|
||||
var(--shadow-outline-width) var(--shadow-outline-width) var(--black-a4);
|
||||
--shadow-interactive:
|
||||
var(--shadow-interactive-shine), var(--shadow-interactive-shadow),
|
||||
var(--shadow-interactive-background);
|
||||
var(--shadow-interactive-background); */
|
||||
|
||||
--shadow-aggressive: var(--space-1) var(--space-1) var(--space-4)
|
||||
var(--black-a11);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
.content {
|
||||
flex: 1;
|
||||
max-width: var(--page-width);
|
||||
overflow: hidden;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { useStrings } from "../hooks/useStrings";
|
||||
import { TankFilters } from "../stores/tankFilters";
|
||||
import { TextField } from "./TextField";
|
||||
|
||||
export function TankSearch() {
|
||||
const strings = useStrings();
|
||||
|
||||
return (
|
||||
<TextField
|
||||
placeholder={strings.tanks.search.placeholder}
|
||||
onChange={(event) => {
|
||||
const trimmed = event.target.value.trim();
|
||||
|
||||
if (trimmed.length === 0) {
|
||||
TankFilters.mutate((draft) => {
|
||||
draft.search = undefined;
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
TankFilters.mutate((draft) => {
|
||||
draft.search = trimmed;
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
border-radius: var(--max-size);
|
||||
|
||||
background-color: var(--gray-1);
|
||||
box-shadow: var(--shadow-interactive), var(--shadow-cavity);
|
||||
outline: var(--outline-interactive);
|
||||
|
||||
input {
|
||||
padding: var(--space-3) var(--space-4);
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
import { classNames } from "../../core/ui/classNames";
|
||||
import "./index.css";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
export interface TextFieldProps extends ComponentProps<"input"> {
|
||||
children?: ReactNode;
|
||||
@@ -51,7 +51,7 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
className={classNames("text-field", className)}
|
||||
className={classNames(styles["text-field"], className)}
|
||||
data-has-icon={children !== undefined}
|
||||
data-disabled={disabled}
|
||||
data-variant={variant}
|
||||
|
||||
Reference in new issue
Block a user