import classNames from 'classnames'; import React from 'react'; import InlineSVG from 'react-inlinesvg'; import { defineMessages, useIntl } from 'react-intl'; import { Link } from 'react-router-dom'; import { Text } from 'soapbox/components/ui'; const sizes = { md: 'p-4 sm:rounded-xl', lg: 'p-4 sm:p-6 sm:rounded-xl', xl: 'p-4 sm:p-10 sm:rounded-3xl', }; const messages = defineMessages({ back: { id: 'card.back.label', defaultMessage: 'Back' }, }); interface ICard { variant?: 'rounded', size?: 'md' | 'lg' | 'xl', className?: string, } const Card: React.FC = React.forwardRef(({ children, variant, size = 'md', className, ...filteredProps }, ref: React.ForwardedRef): JSX.Element => (
{children}
)); interface ICardHeader { backHref?: string, onBackClick?: (event: React.MouseEvent) => void } const CardHeader: React.FC = ({ children, backHref, onBackClick }): JSX.Element => { const intl = useIntl(); const renderBackButton = () => { if (!backHref && !onBackClick) { return null; } const Comp: React.ElementType = backHref ? Link : 'button'; const backAttributes = backHref ? { to: backHref } : { onClick: onBackClick }; return ( Back ); }; return (
{renderBackButton()} {children}
); }; interface ICardTitle { title: string | React.ReactNode } const CardTitle = ({ title }: ICardTitle): JSX.Element => ( {title} ); const CardBody: React.FC = ({ children }): JSX.Element => (
{children}
); export { Card, CardHeader, CardTitle, CardBody };