Skip to content

Instantly share code, notes, and snippets.

@onesamket
Created March 21, 2024 12:25
Show Gist options
  • Save onesamket/9e6ce55cc9fce5aa76330d43af29053e to your computer and use it in GitHub Desktop.
Save onesamket/9e6ce55cc9fce5aa76330d43af29053e to your computer and use it in GitHub Desktop.
import { ComponentProps, forwardRef } from 'react'
import { twMerge } from 'tailwind-merge'
export const RootLayout = ({ children, className, ...props }: ComponentProps<'main'>) => {
return (
<main className={twMerge('flex flex-row h-screen', className)} {...props}>
{children}
</main>
)
}
export const Sidebar = ({ className, children, ...props }: ComponentProps<'aside'>) => {
return (
<aside
className={twMerge('w-[250px] mt-10 h-[100vh + 10px] overflow-auto', className)}
{...props}
>
{children}
</aside>
)
}
export const Content = forwardRef<HTMLDivElement, ComponentProps<'div'>>(
({ children, className, ...props }, ref) => (
<div ref={ref} className={twMerge('flex-1 overflow-auto', className)} {...props}>
{children}
</div>
)
)
Content.displayName = 'Content'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment