From ecb592ee9329fadf13fffa934264796bdb053af3 Mon Sep 17 00:00:00 2001 From: Francesco Sansalvadore Date: Thu, 13 Apr 2023 11:21:32 +0200 Subject: [PATCH] chore: add mdx Img component --- apps/www/lib/mdx/mdxComponents.tsx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/apps/www/lib/mdx/mdxComponents.tsx b/apps/www/lib/mdx/mdxComponents.tsx index a54bee5c0ad..e08739ca7bb 100644 --- a/apps/www/lib/mdx/mdxComponents.tsx +++ b/apps/www/lib/mdx/mdxComponents.tsx @@ -12,6 +12,18 @@ import { Badge } from 'ui' const ignoreClass = 'ignore-on-export' +const getCaptionAlign = (align?: 'left' | 'center' | 'right') => { + switch (align) { + case 'left': + return 'text-left' + case 'right': + return 'text-right' + case 'center': + default: + return 'text-center' + } +} + export default function mdxComponents(type?: 'blog' | 'lp' | undefined) { const components = { CodeBlock, @@ -43,6 +55,22 @@ export default function mdxComponents(type?: 'blog' | 'lp' | undefined) { } return }, + Img: (props: any) => ( +
+ + + + {props.caption && ( +
+ {props.caption} +
+ )} +
+ ), code: (props: any) => {props.children}, }