mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: form fields
This commit is contained in:
1 parent
b9bbf22f2c
commit
6a58c5ea1d
3 files changed
+25
-7
No files matched your search
@@ -51,6 +51,7 @@ function Content({ path }: Props) {
|
|||||||
<Fragment key={index}>
|
<Fragment key={index}>
|
||||||
{index > 0 && (
|
{index > 0 && (
|
||||||
<TextField
|
<TextField
|
||||||
|
variant="form"
|
||||||
className={styles.slug}
|
className={styles.slug}
|
||||||
placeholder={`[${slug}]`}
|
placeholder={`[${slug}]`}
|
||||||
align="center"
|
align="center"
|
||||||
|
|||||||
@@ -5,15 +5,30 @@
|
|||||||
|
|
||||||
gap: var(--space-3);
|
gap: var(--space-3);
|
||||||
|
|
||||||
border-radius: var(--max-size);
|
|
||||||
|
|
||||||
background-color: var(--gray-1);
|
|
||||||
box-shadow: var(--shadow-interactive), var(--shadow-cavity);
|
|
||||||
cursor: text;
|
cursor: text;
|
||||||
|
|
||||||
font: inherit;
|
font: inherit;
|
||||||
color: var(--gray-11);
|
color: var(--gray-11);
|
||||||
|
|
||||||
|
&[data-variant="bubble"] {
|
||||||
|
border-radius: var(--max-size);
|
||||||
|
|
||||||
|
background-color: var(--gray-1);
|
||||||
|
box-shadow: var(--shadow-interactive), var(--shadow-cavity);
|
||||||
|
|
||||||
|
input {
|
||||||
|
padding: var(--space-3) var(--space-4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&[data-variant="form"] {
|
||||||
|
border-bottom: var(--space-1) solid var(--gray-6);
|
||||||
|
|
||||||
|
input {
|
||||||
|
padding: var(--space-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&[data-has-icon="true"] {
|
&[data-has-icon="true"] {
|
||||||
padding-left: var(--space-3);
|
padding-left: var(--space-3);
|
||||||
|
|
||||||
@@ -34,7 +49,7 @@
|
|||||||
color: var(--gray-9);
|
color: var(--gray-9);
|
||||||
|
|
||||||
input::placeholder {
|
input::placeholder {
|
||||||
color: var(--gray-9);
|
color: var(--gray-6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,12 +67,11 @@
|
|||||||
cursor: inherit;
|
cursor: inherit;
|
||||||
|
|
||||||
font: inherit;
|
font: inherit;
|
||||||
padding: var(--space-3) var(--space-4);
|
|
||||||
|
|
||||||
color: var(--gray-12);
|
color: var(--gray-12);
|
||||||
|
|
||||||
&::placeholder {
|
&::placeholder {
|
||||||
color: var(--gray-11);
|
color: var(--gray-9);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export interface TextFieldProps extends ComponentProps<"input"> {
|
|||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
align?: "left" | "center" | "right";
|
align?: "left" | "center" | "right";
|
||||||
autoWidth?: boolean;
|
autoWidth?: boolean;
|
||||||
|
variant?: "bubble" | "form";
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
||||||
@@ -27,6 +28,7 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|||||||
disabled,
|
disabled,
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
|
variant = "bubble",
|
||||||
...props
|
...props
|
||||||
},
|
},
|
||||||
ref,
|
ref,
|
||||||
@@ -52,6 +54,7 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|||||||
className={classNames("text-field", className)}
|
className={classNames("text-field", className)}
|
||||||
data-has-icon={children !== undefined}
|
data-has-icon={children !== undefined}
|
||||||
data-disabled={disabled}
|
data-disabled={disabled}
|
||||||
|
data-variant={variant}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
<input
|
<input
|
||||||
|
|||||||
Reference in new issue
Block a user