mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: styles
This commit is contained in:
1 parent
0cb974acf5
commit
649cdd893f
5 files changed
+76
-15
No files matched your search
@@ -24,5 +24,9 @@
|
|||||||
"avatars": { "name": "Avatars" },
|
"avatars": { "name": "Avatars" },
|
||||||
"backgrounds": { "name": "Backgrounds" },
|
"backgrounds": { "name": "Backgrounds" },
|
||||||
"api": { "name": "API" }
|
"api": { "name": "API" }
|
||||||
|
},
|
||||||
|
|
||||||
|
"home": {
|
||||||
|
"search": "Search tanks, players, tools..."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,11 +25,22 @@
|
|||||||
--weight-extra-bold: 800;
|
--weight-extra-bold: 800;
|
||||||
--weight-black: 900;
|
--weight-black: 900;
|
||||||
|
|
||||||
--font-size-regular: 1rem;
|
--font-size-regular: var(--space-4);
|
||||||
|
|
||||||
|
--max-size: max(100vw, 100vh);
|
||||||
|
|
||||||
|
--outline-interactive: solid var(--space-1) var(--gray-5);
|
||||||
|
--outline-focus: var(--space-1) solid var(--accent-6);
|
||||||
|
|
||||||
|
--shadow-cavity:
|
||||||
|
inset var(--space-1) var(--space-1) var(--space-1) var(--gray-2),
|
||||||
|
inset calc(var(--space-1) * -1) calc(var(--space-1) * -1) var(--space-1)
|
||||||
|
var(--gray-4);
|
||||||
|
--shadow-focus: 0 0 var(--space-3) var(--accent-4);
|
||||||
|
|
||||||
background-color: var(--gray-1);
|
background-color: var(--gray-1);
|
||||||
color: var(--gray-12);
|
color: var(--gray-12);
|
||||||
font-family: "Roboto Flex", sans-serif;
|
font-family: "Roboto Flex";
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
---
|
---
|
||||||
|
import { MagnifyingGlassIcon } from "@radix-ui/react-icons";
|
||||||
import { TextField } from "./TextField";
|
import { TextField } from "./TextField";
|
||||||
|
|
||||||
|
const strings = { home: { search: "test" } };
|
||||||
---
|
---
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -40,5 +43,7 @@ import { TextField } from "./TextField";
|
|||||||
<div class="wrapper"></div>
|
<div class="wrapper"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TextField placeholder="asdasdasd" />
|
<TextField placeholder={strings.home.search}>
|
||||||
|
<MagnifyingGlassIcon />
|
||||||
|
</TextField>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,19 +1,51 @@
|
|||||||
.text-field {
|
.text-field {
|
||||||
min-width: 0;
|
display: flex;
|
||||||
max-width: var(--space-9);
|
align-items: center;
|
||||||
|
|
||||||
border-radius: 9999px;
|
gap: var(--space-3);
|
||||||
|
width: 100%;
|
||||||
background-color: var(--gray-3);
|
max-width: 40rem;
|
||||||
border: solid 1px var(--gray-6);
|
|
||||||
color: var(--gray-12);
|
|
||||||
padding: var(--space-3) var(--space-4);
|
|
||||||
margin: 0 var(--space-4);
|
margin: 0 var(--space-4);
|
||||||
|
|
||||||
font-weight: var(--weight-medium);
|
border-radius: var(--max-size);
|
||||||
|
|
||||||
|
background-color: var(--gray-3);
|
||||||
|
outline: var(--outline-interactive);
|
||||||
|
box-shadow: var(--shadow-cavity);
|
||||||
|
|
||||||
font-size: var(--font-size-regular);
|
font-size: var(--font-size-regular);
|
||||||
|
color: var(--gray-11);
|
||||||
|
|
||||||
&[data-has-icon="true"] {
|
&[data-has-icon="true"] {
|
||||||
padding-left: var(--space-3);
|
padding-left: var(--space-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:focus-within {
|
||||||
|
outline: var(--outline-focus);
|
||||||
|
box-shadow: var(--shadow-focus);
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
width: 1em;
|
||||||
|
height: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
|
||||||
|
font-size: inherit;
|
||||||
|
font-weight: medium;
|
||||||
|
padding: var(--space-3) 0;
|
||||||
|
|
||||||
|
color: var(--gray-12);
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
color: var(--gray-11);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,15 @@
|
|||||||
import type { ComponentProps } from "react";
|
import type { ComponentProps, ReactNode } from "react";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
|
||||||
export function TextField(props: ComponentProps<"input">) {
|
export interface TextFieldProps extends ComponentProps<"input"> {
|
||||||
return <input className="text-field" {...props} />;
|
children?: ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function TextField({ children, ...props }: TextFieldProps) {
|
||||||
|
return (
|
||||||
|
<div className="text-field" data-has-icon={children !== undefined}>
|
||||||
|
{children}
|
||||||
|
<input {...props} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user