Add extra component for input group

This commit is contained in:
Arnaud 2024-10-04 18:38:54 +02:00
parent 2312007a4c
commit 4c90f07abb
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663
2 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { ChangeEvent, CSSProperties, LegacyRef } from "react";
import { ChangeEvent, CSSProperties, LegacyRef, ReactNode } from "react";
import "./inputGroup.css";
import { Input } from "../Input/Input";
import { Select } from "../Select/Select";
@ -82,6 +82,8 @@ type Props = {
max?: number | string;
inputRef?: LegacyRef<HTMLInputElement>;
extra?: ReactNode;
};
export function InputGroup({
@ -106,6 +108,7 @@ export function InputGroup({
inputRef,
min,
max,
extra,
}: Props) {
return (
<div className={`inputGroup ${className}`} style={style}>
@ -146,7 +149,12 @@ export function InputGroup({
)}
</div>
</div>
<div className="inputGroup-helpers">
<span>
{helper && <small className="inputGroup-helper">{helper}</small>}
</span>
{extra}
</div>
</div>
</div>
);

View File

@ -37,3 +37,9 @@ select.inputGroup-select {
.inputGroup-inputContainer {
flex: 1;
}
.inputGroup-helpers {
display: flex;
justify-content: space-between;
align-items: center;
}