🐛 fix(parameterComponent): add refNumberComponents to keep track of the number of components

🐛 fix(parameterComponent): change text-destructive class to text-status-red for better semantics
🐛 fix(ModalField): change text-destructive class to text-status-red for better semantics
🐛 fix(codeAreaModal): change text-destructive class to text-status-red for better semantics
This commit is contained in:
Cristhian Zanforlin Lousa 2023-07-10 22:43:34 -03:00
commit d2f28dee6b
3 changed files with 8 additions and 4 deletions

View file

@ -41,6 +41,7 @@ export default function ParameterComponent({
}: ParameterComponentType) { }: ParameterComponentType) {
const ref = useRef(null); const ref = useRef(null);
const refHtml = useRef(null); const refHtml = useRef(null);
const refNumberComponents = useRef(0);
const infoHtml = useRef(null); const infoHtml = useRef(null);
const updateNodeInternals = useUpdateNodeInternals(); const updateNodeInternals = useUpdateNodeInternals();
const [position, setPosition] = useState(0); const [position, setPosition] = useState(0);
@ -91,9 +92,12 @@ export default function ParameterComponent({
); );
}, [info]); }, [info]);
useEffect(() => { useEffect(() => {
const groupedObj = groupByFamily(myData, tooltipTitle, left, data.type); const groupedObj = groupByFamily(myData, tooltipTitle, left, data.type);
refNumberComponents.current = groupedObj[0]?.component?.length;
refHtml.current = groupedObj.map((item, i) => { refHtml.current = groupedObj.map((item, i) => {
const Icon: any = nodeIconsLucide[item.family]; const Icon: any = nodeIconsLucide[item.family];
@ -155,7 +159,7 @@ export default function ParameterComponent({
} }
> >
{title} {title}
<span className="text-destructive">{required ? " *" : ""}</span> <span className="text-status-red">{required ? " *" : ""}</span>
<div className=""> <div className="">
{info !== "" && ( {info !== "" && (
<ShadTooltip content={infoHtml.current}> <ShadTooltip content={infoHtml.current}>
@ -176,7 +180,7 @@ export default function ParameterComponent({
<></> <></>
) : ( ) : (
<ShadTooltip <ShadTooltip
style="tooltip-fixed-width custom-scroll" style={refNumberComponents.current > 10 ? "tooltip-fixed-width custom-scroll overflow-y-scroll nowheel" : "tooltip-fixed-width"}
delayDuration={0} delayDuration={0}
content={refHtml.current} content={refHtml.current}
side={left ? "left" : "right"} side={left ? "left" : "right"}

View file

@ -52,7 +52,7 @@ export default function ModalField({
{display && ( {display && (
<div> <div>
<span className="mx-2">{title}</span> <span className="mx-2">{title}</span>
<span className="text-destructive">{required ? " *" : ""}</span> <span className="text-status-red">{required ? " *" : ""}</span>
</div> </div>
)} )}

View file

@ -129,7 +129,7 @@ export default function CodeAreaModal({
} }
> >
<div className="mt-1 h-full w-full overflow-x-clip overflow-y-scroll text-left custom-scroll"> <div className="mt-1 h-full w-full overflow-x-clip overflow-y-scroll text-left custom-scroll">
<h1 className="text-lg text-destructive"> <h1 className="text-lg text-status-red">
{error?.detail?.error} {error?.detail?.error}
</h1> </h1>
<div className="ml-2 w-full break-all text-sm text-status-red"> <div className="ml-2 w-full break-all text-sm text-status-red">