cs-2022-class-profile/components/SideComponentWrapper.tsx

34 lines
737 B
TypeScript
Raw Normal View History

2022-08-08 23:15:38 -04:00
import React from "react";
import styles from "./SideComponentWrapper.module.css";
type ComponentWrapperProps = {
children: React.ReactNode;
heading: string;
body: string;
2022-08-12 00:41:14 -04:00
align?: "left" | "right";
2022-08-12 00:20:55 -04:00
noBackground?: boolean;
2022-08-08 23:15:38 -04:00
};
2022-08-12 00:20:55 -04:00
export function SideComponentWrapper({
2022-08-08 23:15:38 -04:00
heading,
body,
children,
2022-08-12 00:41:14 -04:00
align = "left",
2022-08-12 00:20:55 -04:00
noBackground = false,
2022-08-08 23:15:38 -04:00
}: ComponentWrapperProps) {
return (
2022-08-12 00:20:55 -04:00
<div
2022-08-12 00:41:14 -04:00
className={`${
align === "right" ? styles.wrapperRight : styles.wrapperLeft
} ${noBackground ? styles.noBackground : ""}`}
2022-08-12 00:20:55 -04:00
>
<div className={styles.internalWrapper}>
<h3>{heading}</h3>
<p>{body}</p>
</div>
<div className={styles.internalWrapper}>{children}</div>
2022-08-08 23:15:38 -04:00
</div>
);
}