mirror of
https://github.com/Sonarr/Sonarr
synced 2026-01-06 07:34:58 +01:00
39 lines
910 B
TypeScript
39 lines
910 B
TypeScript
import React from 'react';
|
|
import Link, { LinkProps } from 'Components/Link/Link';
|
|
import styles from './Card.css';
|
|
|
|
interface CardProps extends Pick<LinkProps, 'onPress'> {
|
|
// TODO: Consider using different properties for classname depending if it's overlaying content or not
|
|
className?: string;
|
|
overlayClassName?: string;
|
|
overlayContent?: boolean;
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
function Card(props: CardProps) {
|
|
const {
|
|
className = styles.card,
|
|
overlayClassName = styles.overlay,
|
|
overlayContent = false,
|
|
children,
|
|
onPress,
|
|
} = props;
|
|
|
|
if (overlayContent) {
|
|
return (
|
|
<div className={className}>
|
|
<Link className={styles.underlay} onPress={onPress} />
|
|
|
|
<div className={overlayClassName}>{children}</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Link className={className} onPress={onPress}>
|
|
{children}
|
|
</Link>
|
|
);
|
|
}
|
|
|
|
export default Card;
|