datahub/examples/basic-example/lib/applyFullWidthDirective.tsx
Luccas Mateus de Medeiros Gomes 58ca032d3f [basic-example][m] - update data to breaking bad
- Fix LineChart and allow the use of URLs
- Add applyFullWidthDirective back
- Fix favicon
- Remove data_1.csv and data_2.csv in favour of data.csv
- Remove vestiges of Vercel
2023-04-27 21:38:48 -03:00

22 lines
617 B
TypeScript

export default function applyFullWidthDirective({
Component,
defaultWFull = true,
}) {
return (props) => {
const newProps = { ...props };
let newClassName = newProps.className || "";
if (newProps.fullWidth === true) {
newClassName += " w-[90vw] ml-[calc(50%-45vw)] max-w-none";
} else if (defaultWFull) {
// So that charts and tables will have the
// same width as the text content, but images
// can have its width set using the width prop
newClassName += " w-full";
}
newProps.className = newClassName;
return <Component {...newProps} />;
};
}