m3-academy-template-vtexio-.../custom/react/components/UI/ResponsiveRender/ResponsiveRender.tsx

21 lines
525 B
TypeScript
Raw Normal View History

2022-08-11 13:06:07 +00:00
import React from "react";
import useResponsiveValidator, { screen_type, validation_type } from "../../../hooks/useResponsiveValidator";
interface ResponsiveRenderProps {
children: JSX.Element[],
type: validation_type
width: screen_type,
}
const ResponsiveRender = ({ children, type, width}: ResponsiveRenderProps): JSX.Element => {
const canRender = useResponsiveValidator({type, width});
return(
<>
{canRender ? children : <></>}
</>
);
};
export default ResponsiveRender;