Add extra component for input group
This commit is contained in:
parent
2312007a4c
commit
4c90f07abb
|
@ -1,4 +1,4 @@
|
||||||
import { ChangeEvent, CSSProperties, LegacyRef } from "react";
|
import { ChangeEvent, CSSProperties, LegacyRef, ReactNode } from "react";
|
||||||
import "./inputGroup.css";
|
import "./inputGroup.css";
|
||||||
import { Input } from "../Input/Input";
|
import { Input } from "../Input/Input";
|
||||||
import { Select } from "../Select/Select";
|
import { Select } from "../Select/Select";
|
||||||
|
@ -82,6 +82,8 @@ type Props = {
|
||||||
max?: number | string;
|
max?: number | string;
|
||||||
|
|
||||||
inputRef?: LegacyRef<HTMLInputElement>;
|
inputRef?: LegacyRef<HTMLInputElement>;
|
||||||
|
|
||||||
|
extra?: ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function InputGroup({
|
export function InputGroup({
|
||||||
|
@ -106,6 +108,7 @@ export function InputGroup({
|
||||||
inputRef,
|
inputRef,
|
||||||
min,
|
min,
|
||||||
max,
|
max,
|
||||||
|
extra,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
return (
|
return (
|
||||||
<div className={`inputGroup ${className}`} style={style}>
|
<div className={`inputGroup ${className}`} style={style}>
|
||||||
|
@ -146,7 +149,12 @@ export function InputGroup({
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="inputGroup-helpers">
|
||||||
|
<span>
|
||||||
{helper && <small className="inputGroup-helper">{helper}</small>}
|
{helper && <small className="inputGroup-helper">{helper}</small>}
|
||||||
|
</span>
|
||||||
|
{extra}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -37,3 +37,9 @@ select.inputGroup-select {
|
||||||
.inputGroup-inputContainer {
|
.inputGroup-inputContainer {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inputGroup-helpers {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue