Fix lint errors
This commit is contained in:
parent
79386c10e0
commit
4b3e24038c
@ -49,7 +49,8 @@ export default function Container({ error = false, children, service }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const resizeObserver = new ResizeObserver((entries) => {
|
const resizeObserver = new ResizeObserver((entries) => {
|
||||||
for (let entry of entries) {
|
for (let i = 0; i < entries.length; i += 1) {
|
||||||
|
const entry = entries[i];
|
||||||
const { width } = entry.contentRect;
|
const { width } = entry.contentRect;
|
||||||
const remSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
const remSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||||
|
|
||||||
@ -58,10 +59,10 @@ export default function Container({ error = false, children, service }) {
|
|||||||
|
|
||||||
if (numberOfChildren > 1 && remWidth > 12) {
|
if (numberOfChildren > 1 && remWidth > 12) {
|
||||||
if (numberOfChildren <= maxChildrenFit) return setChildrensToSlice(0);
|
if (numberOfChildren <= maxChildrenFit) return setChildrensToSlice(0);
|
||||||
const childrensToSlice = remWidth / 6 > 1 ? parseInt(numberOfChildren / maxChildrenFit) : 0;
|
setChildrensToSlice(remWidth / 6 > 1 ? parseInt(numberOfChildren / maxChildrenFit, 10) : 0);
|
||||||
setChildrensToSlice(childrensToSlice);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (containerRef.current) {
|
if (containerRef.current) {
|
||||||
@ -71,7 +72,7 @@ export default function Container({ error = false, children, service }) {
|
|||||||
return () => {
|
return () => {
|
||||||
resizeObserver.disconnect();
|
resizeObserver.disconnect();
|
||||||
};
|
};
|
||||||
}, []);
|
}, [numberOfChildren]);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
if (settings.hideErrors || service.widget.hide_errors) {
|
if (settings.hideErrors || service.widget.hide_errors) {
|
||||||
@ -86,9 +87,7 @@ export default function Container({ error = false, children, service }) {
|
|||||||
<div className={`relative grid p-1 gap-2 w-full auto-rows-max ${subColumnsClassMap[numberOfChildren]}`}>
|
<div className={`relative grid p-1 gap-2 w-full auto-rows-max ${subColumnsClassMap[numberOfChildren]}`}>
|
||||||
{childrensTopRows}
|
{childrensTopRows}
|
||||||
{childrensToSlice > 0 && (
|
{childrensToSlice > 0 && (
|
||||||
<div
|
<div className="relative grid col-span-full p-1 gap-2 w-full auto-rows-max grid-cols-[repeat(auto-fit,minmax(6rem,1fr))]">
|
||||||
className={`relative grid col-span-full p-1 gap-2 w-full auto-rows-max grid-cols-[repeat(auto-fit,minmax(6rem,1fr))]`}
|
|
||||||
>
|
|
||||||
{childrensBottomRows}
|
{childrensBottomRows}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user