-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b3530d
commit a8049c4
Showing
11 changed files
with
201 additions
and
62 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@babylonlabs-io/bbn-core-ui": minor | ||
--- | ||
|
||
add form control component |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.bbn-form-control { | ||
@apply flex flex-col; | ||
|
||
&-hint { | ||
@apply mt-1 text-sm; | ||
|
||
&.bbn-form-control-hint-error { | ||
@apply text-error-main; | ||
} | ||
|
||
&.bbn-form-control-hint-warning { | ||
@apply text-warning-main; | ||
} | ||
|
||
&.bbn-form-control-hint-success { | ||
@apply text-success-main; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { type PropsWithChildren } from "react"; | ||
import { twJoin } from "tailwind-merge"; | ||
import "./FormControl.css"; | ||
|
||
export interface FormControlProps extends PropsWithChildren { | ||
label?: string; | ||
hint?: string; | ||
state?: "default" | "error" | "warning" | "success"; | ||
className?: string; | ||
wrapperClassName?: string; | ||
} | ||
|
||
export function FormControl({ | ||
children, | ||
label, | ||
hint, | ||
state = "default", | ||
className, | ||
wrapperClassName, | ||
}: FormControlProps) { | ||
return ( | ||
<div className={twJoin("bbn-form-control", wrapperClassName)}> | ||
{label && <label className="bbn-form-control-label mb-2 block text-sm text-primary-light">{label}</label>} | ||
|
||
<div className={className}>{children}</div> | ||
|
||
{hint && <span className={twJoin("bbn-form-control-hint", `bbn-form-control-hint-${state}`)}>{hint}</span>} | ||
</div> | ||
); | ||
} |
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