blob: 3d6bc7b01623e5d22551499b7c92f4f1e28c7273 (
plain)
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
|
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);
|