-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHalfs.tsx
More file actions
28 lines (25 loc) · 827 Bytes
/
Halfs.tsx
File metadata and controls
28 lines (25 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { forwardRef, type HTMLAttributes, type ReactNode } from "react";
import { cx } from "^/lib/cva";
export interface HalfsProps extends HTMLAttributes<HTMLElement> {
left: ReactNode;
center?: ReactNode;
right: ReactNode;
}
const Halfs = forwardRef<HTMLElement, HalfsProps>(
({ left, center, right, className, ...props }, ref) => (
<section className={cx("flex", className)} {...props} ref={ref}>
<div className="flex flex-1 justify-end">
{/* Left half */}
{left}
</div>
{/* Center column */}
{center}
<div className="flex flex-1 justify-start">
{/* Right half */}
{right}
</div>
</section>
),
);
Halfs.displayName = "Halfs";
export default Halfs;