mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: finalize tool cards
This commit is contained in:
1 parent
9096644d51
commit
01a58f9aa8
13 files changed
+143
-45
No files matched your search
@@ -1,6 +1,7 @@
|
||||
.text-field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
|
||||
gap: var(--space-3);
|
||||
margin: 0 var(--space-4);
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import type { ComponentProps, ReactNode } from "react";
|
||||
import {
|
||||
forwardRef,
|
||||
useImperativeHandle,
|
||||
useRef,
|
||||
type ComponentProps,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
import { classNames } from "../../core/ui/classNames";
|
||||
import "./index.css";
|
||||
|
||||
@@ -6,14 +12,20 @@ export interface TextFieldProps extends ComponentProps<"input"> {
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export function TextField({ children, className, ...props }: TextFieldProps) {
|
||||
return (
|
||||
<div
|
||||
className={classNames("text-field", className)}
|
||||
data-has-icon={children !== undefined}
|
||||
>
|
||||
{children}
|
||||
<input {...props} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
||||
({ children, className, ...props }, ref) => {
|
||||
const input = useRef<HTMLInputElement>(null);
|
||||
|
||||
useImperativeHandle(ref, () => input.current!, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames("text-field", className)}
|
||||
data-has-icon={children !== undefined}
|
||||
>
|
||||
{children}
|
||||
<input ref={input} {...props} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
Reference in new issue
Block a user