aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/card/card-cover.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/molecules/card/card-cover.tsx')
-rw-r--r--src/components/molecules/card/card-cover.tsx29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/components/molecules/card/card-cover.tsx b/src/components/molecules/card/card-cover.tsx
new file mode 100644
index 0000000..3d6bc7b
--- /dev/null
+++ b/src/components/molecules/card/card-cover.tsx
@@ -0,0 +1,29 @@
+import {
+ type ForwardRefRenderFunction,
+ type ReactElement,
+ forwardRef,
+} from 'react';
+import { Figure, type FigureProps } from '../../atoms';
+import styles from './card.module.scss';
+
+export type CardCoverProps = Omit<FigureProps, 'caption' | 'children'> & {
+ /**
+ * The cover.
+ */
+ children: ReactElement;
+};
+
+const CardCoverWithRef: ForwardRefRenderFunction<
+ HTMLElement,
+ CardCoverProps
+> = ({ className = '', children, ...props }, ref) => {
+ const coverClass = `${styles.cover} ${className}`;
+
+ return (
+ <Figure {...props} className={coverClass} ref={ref}>
+ {children}
+ </Figure>
+ );
+};
+
+export const CardCover = forwardRef(CardCoverWithRef);