-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tooltip, helper text and notice (#192)
- Loading branch information
Showing
10 changed files
with
230 additions
and
47 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 @@ | ||
--- | ||
"@premieroctet/next-admin": minor | ||
--- | ||
|
||
feat: add tooltip, helper text and notice |
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,30 @@ | ||
import { InformationCircleIcon } from "@heroicons/react/24/solid"; | ||
import { FieldProps } from "@rjsf/utils"; | ||
import { useI18n } from "../../context/I18nContext"; | ||
|
||
const NullField = ({ schema }: FieldProps) => { | ||
const { t } = useI18n(); | ||
|
||
return ( | ||
<div className="rounded-md bg-blue-50 p-4 w-full"> | ||
<div className="flex"> | ||
<div className="flex-shrink-0"> | ||
<InformationCircleIcon | ||
className="h-5 w-5 text-blue-400" | ||
aria-hidden="true" | ||
/> | ||
</div> | ||
<div className="ml-3"> | ||
<h3 className="text-sm font-medium text-blue-800"> | ||
{t(schema.title!)} | ||
</h3> | ||
{!!schema.description && ( | ||
<p className="text-sm text-blue-700">{t(schema.description)}</p> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NullField; |
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,25 @@ | ||
import * as Tooltip from "@radix-ui/react-tooltip"; | ||
import { forwardRef } from "react"; | ||
import clsx from "clsx"; | ||
|
||
export const TooltipProvider = Tooltip.Provider; | ||
export const TooltipRoot = Tooltip.Root; | ||
export const TooltipTrigger = Tooltip.Trigger; | ||
export const TooltipArrow = Tooltip.Arrow; | ||
export const TooltipPortal = Tooltip.Portal; | ||
|
||
export const TooltipContent = forwardRef< | ||
React.ElementRef<typeof Tooltip.Content>, | ||
Tooltip.TooltipContentProps | ||
>(({ className, ...props }, ref) => { | ||
return ( | ||
<Tooltip.Content | ||
{...props} | ||
className={clsx( | ||
"text-sm text-gray-500 border border-slate-100 bg-slate-50 shadow-xl rounded", | ||
className | ||
)} | ||
ref={ref} | ||
/> | ||
); | ||
}); |
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.