COMPLETE: CardMedia component
This commit is contained in:
219
package-lock.json
generated
219
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,21 +1,17 @@
|
|||||||
// import { forwardRef } from 'react';
|
import React, { forwardRef } from 'react';
|
||||||
// import { CardMediaProps, CardMedia } from "./card.types";
|
import { CardMediaProps, CardMediaType } from './card.types';
|
||||||
|
|
||||||
// export const CardMedia = forwardRef<CardMedia, CardMediaProps>(
|
export const CardMedia = forwardRef<CardMediaType, CardMediaProps>(
|
||||||
// ({rounded = true, preview = true, type, ...props}, ref) => {
|
(
|
||||||
// const classes = `m3 m3-card-media${rounded ? ' media-rounded' : ''}${preview ? ' media-preview' : ''} ${props.className ?? ''}`.trimEnd();
|
{ rounded = true, preview = true, type, className = '', ...props },
|
||||||
// switch (type){
|
ref,
|
||||||
// case "audio":
|
) => {
|
||||||
// break;
|
const classes =
|
||||||
// case "iframe":
|
`m3 m3-card-media${rounded ? ' m3-rounded' : ''}${preview ? ' m3-preview' : ''} ${className}`.trimEnd();
|
||||||
// break;
|
return React.createElement(type, {
|
||||||
// case "img":
|
...props,
|
||||||
// break;
|
className: classes,
|
||||||
// case "picture":
|
ref: ref,
|
||||||
// break;
|
});
|
||||||
// case "video":
|
},
|
||||||
// break;
|
);
|
||||||
// default:
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ export interface CardActionAreaProps
|
|||||||
|
|
||||||
export interface CardProps extends ContainerProps {}
|
export interface CardProps extends ContainerProps {}
|
||||||
|
|
||||||
export interface CardMediaProps extends HTMLAttributes<CardMedia> {
|
export interface CardMediaProps extends HTMLAttributes<CardMediaType> {
|
||||||
type: 'img' | 'video' | 'picture' | 'iframe' | 'audio';
|
type: 'img' | 'video' | 'picture' | 'iframe' | 'audio';
|
||||||
rounded?: boolean;
|
rounded?: boolean;
|
||||||
preview?: boolean;
|
preview?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CardMedia = HTMLImageElement &
|
export type CardMediaType = HTMLImageElement &
|
||||||
HTMLVideoElement &
|
HTMLVideoElement &
|
||||||
HTMLPictureElement &
|
HTMLPictureElement &
|
||||||
HTMLMediaElement &
|
HTMLMediaElement &
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user