2022-02-05 15:46:24 +03:00
|
|
|
import { faArrowAltCircleRight as linkIcon } from '@fortawesome/free-regular-svg-icons';
|
2022-02-05 12:46:46 +03:00
|
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
2023-03-18 12:17:17 +03:00
|
|
|
import type { FC, PropsWithChildren, ReactNode } from 'react';
|
2023-02-18 13:11:01 +03:00
|
|
|
import { Link } from 'react-router-dom';
|
2023-03-18 12:17:17 +03:00
|
|
|
import { Card, CardText, CardTitle, UncontrolledTooltip } from 'reactstrap';
|
2023-07-29 11:43:15 +03:00
|
|
|
import { useElementRef } from '../../utils/helpers/hooks';
|
2022-02-05 12:04:34 +03:00
|
|
|
import './HighlightCard.scss';
|
|
|
|
|
2022-04-24 11:39:11 +03:00
|
|
|
export type HighlightCardProps = PropsWithChildren<{
|
2022-02-05 12:04:34 +03:00
|
|
|
title: string;
|
2023-07-24 19:10:22 +03:00
|
|
|
link: string;
|
2023-03-18 12:17:17 +03:00
|
|
|
tooltip?: ReactNode;
|
2022-04-24 11:39:11 +03:00
|
|
|
}>;
|
2022-02-05 12:04:34 +03:00
|
|
|
|
2023-07-24 19:10:22 +03:00
|
|
|
const buildExtraProps = (link: string) => ({ tag: Link, to: link });
|
2022-02-05 12:46:46 +03:00
|
|
|
|
2023-03-18 12:17:17 +03:00
|
|
|
export const HighlightCard: FC<HighlightCardProps> = ({ children, title, link, tooltip }) => {
|
|
|
|
const ref = useElementRef<HTMLElement>();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Card innerRef={ref} className="highlight-card" body {...buildExtraProps(link)}>
|
2023-07-24 19:10:22 +03:00
|
|
|
<FontAwesomeIcon size="3x" className="highlight-card__link-icon" icon={linkIcon} />
|
2023-03-18 12:17:17 +03:00
|
|
|
<CardTitle tag="h5" className="highlight-card__title">{title}</CardTitle>
|
|
|
|
<CardText tag="h2">{children}</CardText>
|
|
|
|
</Card>
|
|
|
|
{tooltip && <UncontrolledTooltip target={ref} placement="bottom">{tooltip}</UncontrolledTooltip>}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|