20 lines
592 B
TypeScript
20 lines
592 B
TypeScript
import { createElement, forwardRef } from 'react';
|
|
import { CardMediaProps, CardMediaType } from './card.types';
|
|
|
|
export const CardMedia = forwardRef<CardMediaType, CardMediaProps>(
|
|
({ type, rounded = true, className = '', ...props }, ref) => {
|
|
const extraClassStyles =
|
|
`m3 m3-card-media${rounded ? ' m3-rounded' : ''} ${className}`.trimEnd();
|
|
|
|
return createElement(
|
|
type,
|
|
{
|
|
...props,
|
|
className: extraClassStyles,
|
|
ref: ref,
|
|
},
|
|
props.children,
|
|
);
|
|
},
|
|
);
|