forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwo-column-section.tsx
More file actions
68 lines (65 loc) · 1.63 KB
/
Copy pathtwo-column-section.tsx
File metadata and controls
68 lines (65 loc) · 1.63 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"use client";
import Image from "next/image";
import { ReactNode } from "react";
interface TwoColumnSectionProps {
imagePosition: "left" | "right";
imageSrc: string;
imageSrcDark?: string;
imageAlt: string;
imageWidth?: number;
imageHeight?: number;
children: ReactNode;
className?: string;
}
export function TwoColumnSection({
imagePosition,
imageSrc,
imageSrcDark,
imageAlt,
imageWidth = 600,
imageHeight = 400,
children,
className = "",
}: TwoColumnSectionProps) {
return (
<div
className={`grid grid-cols-1 lg:grid-cols-2 gap-8 items-center my-8 ${imagePosition === "left" ? "lg:flex-row-reverse" : ""} ${className}`}
>
<div
className={`${imagePosition === "left" ? "lg:order-2" : "lg:order-1"}`}
>
{children}
</div>
<div
className={`${imagePosition === "left" ? "lg:order-1" : "lg:order-2"}`}
>
{imageSrcDark ? (
<>
<Image
src={imageSrc}
alt={imageAlt}
width={imageWidth}
height={imageHeight}
className="rounded-lg w-full h-auto block dark:hidden"
/>
<Image
src={imageSrcDark}
alt={imageAlt}
width={imageWidth}
height={imageHeight}
className="rounded-lg w-full h-auto hidden dark:block"
/>
</>
) : (
<Image
src={imageSrc}
alt={imageAlt}
width={imageWidth}
height={imageHeight}
className="rounded-lg w-full h-auto"
/>
)}
</div>
</div>
);
}