diff --git a/src/components/Layout/MDXWrapper.tsx b/src/components/Layout/MDXWrapper.tsx index ef5c5c342e..9059726da7 100644 --- a/src/components/Layout/MDXWrapper.tsx +++ b/src/components/Layout/MDXWrapper.tsx @@ -16,6 +16,7 @@ import { HtmlComponentPropsData } from '../html-component-props'; import { languageData } from 'src/data/languages'; import { ActivePage } from './utils/nav'; import { Table, TableHead, TableBody, TableRow, TableHeader, TableCell } from './mdx/tables'; +import { Tiles } from './mdx/tiles'; import { Head } from '../Head'; import { useSiteMetadata } from 'src/hooks/use-site-metadata'; import { ProductName } from 'src/templates/template-data'; @@ -126,6 +127,7 @@ const MDXWrapper: React.FC = ({ children, pageContext, location tr: TableRow, th: TableHeader, td: TableCell, + Tiles, }} > {title} diff --git a/src/components/Layout/mdx/tiles.tsx b/src/components/Layout/mdx/tiles.tsx new file mode 100644 index 0000000000..a4d50b48b4 --- /dev/null +++ b/src/components/Layout/mdx/tiles.tsx @@ -0,0 +1,43 @@ +import Link from 'src/components/Link'; +import Icon from '@ably/ui/core/Icon'; +import { IconName } from '@ably/ui/core/Icon/types'; + +type TileProps = { + title?: string; + description?: string; + image?: IconName; + link?: string; +}; + +const Tile = ({ title, description, image, link = '/docs' }: TileProps) => { + return ( + +
+
+ {image && } +
+
+

{title}

+

+ {description} +

+
+
+ + ); +}; + +export const Tiles = ({ children }: { children: TileProps[] }) => { + return ( +
+ {children + .filter((item) => item.title && item.description) + .map((item: TileProps) => ( + + ))} +
+ ); +};