import React from 'react';
import { Link } from 'gatsby';
import { GatsbyImage } from 'gatsby-plugin-image';
import SkeletonLoader from 'tiny-skeleton-loader-react';
import { ImageObject } from '../../types';
import { Theme, useGlobalState } from '../../context';
import * as classes from './style.module.css';
export interface ArticleCard {
image?: ImageObject;
category: string;
title: string;
publishedAt: Date;
readingTime?: string;
link: string;
}
interface ArticleCardProps {
data: ArticleCard;
showBanner?: boolean;
}
export function ArticleCard(props: ArticleCardProps): React.ReactElement {
const { globalState } = useGlobalState();
const darkModeEnabled = globalState.theme === Theme.Dark;
// Needed to differentiate between external and internal links (whether or not we use Gatsby Link)
const absoluteUrl = props.data.link.indexOf('://') > 0 || props.data.link.indexOf('//') === 0;
const articleCard = (
{props.data.title}