-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
functionality from figma for limit orders
- Loading branch information
1 parent
a52a126
commit c5f453d
Showing
9 changed files
with
431 additions
and
544 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,43 @@ | ||
import React, { ReactNode } from "react"; | ||
import { ValidationResult } from "redux/orderInputSlice"; | ||
|
||
type Props = Omit<JSX.IntrinsicElements["input"], "className"> & { | ||
parentClasses?: string; | ||
inputClasses?: string; | ||
endAdornmentClasses?: string; | ||
endAdornment?: ReactNode; | ||
isError?: boolean; | ||
validation?: ValidationResult; | ||
}; | ||
|
||
export const Input = ({ | ||
parentClasses = "", | ||
inputClasses = "", | ||
endAdornment, | ||
isError = false, | ||
endAdornmentClasses = "", | ||
validation, | ||
...inputProps | ||
}: Props) => { | ||
const isError = validation?.valid === false; | ||
return ( | ||
<div | ||
className={ | ||
"flex flex-row items-center bg-base-300 " + | ||
(isError ? "border border-error " : "") + | ||
parentClasses | ||
} | ||
> | ||
<input | ||
className={"input w-full px-2 border-0 " + inputClasses} | ||
{...inputProps} | ||
/> | ||
{endAdornment && ( | ||
<div className={"px-3 " + endAdornmentClasses}>{endAdornment}</div> | ||
)} | ||
</div> | ||
<> | ||
<div | ||
className={ | ||
"flex flex-row items-center bg-base-300 " + | ||
(isError ? "border border-error " : "") + | ||
parentClasses | ||
} | ||
> | ||
<input | ||
className={"input w-full px-2 border-0 " + inputClasses} | ||
{...inputProps} | ||
/> | ||
{endAdornment && ( | ||
<div className={"px-3 " + endAdornmentClasses}>{endAdornment}</div> | ||
)} | ||
</div> | ||
<label className="label"> | ||
<span className="label-text-alt text-error">{validation?.message}</span> | ||
</label> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.