Skip to content

Instantly share code, notes, and snippets.

@WasathTheekshana
Created October 17, 2023 04:09
Show Gist options
  • Save WasathTheekshana/c79eb741f20c7a5c5dd5f92434e9e0e3 to your computer and use it in GitHub Desktop.
Save WasathTheekshana/c79eb741f20c7a5c5dd5f92434e9e0e3 to your computer and use it in GitHub Desktop.
A container to wrap all the children elements according to the break points | NEXTJS COMPONENT | TAILWIND CSS
// Use this component to wrap all the content of the page
'use client';
interface ContainerProps {
children: React.ReactNode;
}
const Container: React.FC<ContainerProps> = ({
children
}) => {
return (
<div
className="
relative
max-w-[1400px]
mx-auto
xl:px-20
md:px-10
sm:px-2
px-6
">
{children}
</div>
);
}
export default Container;
@WasathTheekshana
Copy link
Author

WasathTheekshana commented Oct 17, 2023

Make sure to add this to your Components folder & re use when you want to wrap elements according to the screen size.

Example

<Container>
 // Add your code here
<Container/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment