From fc3af98eda2a2e2c7b25a471d53fd8ddf91616ff Mon Sep 17 00:00:00 2001 From: julieg18 Date: Thu, 5 May 2022 07:01:41 -0500 Subject: [PATCH] Enhance Admonitions * stop admonitions `icon` prop from defaulting to type --- .../Documentation/Markdown/Admonition/index.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/gatsby-theme-iterative-docs/src/components/Documentation/Markdown/Admonition/index.tsx b/plugins/gatsby-theme-iterative-docs/src/components/Documentation/Markdown/Admonition/index.tsx index df30cb7f9b..176393a07f 100644 --- a/plugins/gatsby-theme-iterative-docs/src/components/Documentation/Markdown/Admonition/index.tsx +++ b/plugins/gatsby-theme-iterative-docs/src/components/Documentation/Markdown/Admonition/index.tsx @@ -2,14 +2,15 @@ import React from 'react' import cn from 'classnames' import * as styles from './styles.module.css' -const icons = { +const icons: { [key: string]: string } = { tip: '💡', info: 'ℹī¸', warn: '⚠ī¸', fire: 'đŸ”Ĩ', exclamation: '❗', lady_beetle: '🐞', - bug: '🐛' + bug: '🐛', + none: '' } const typeOptions = ['info', 'tip', 'warn'] const defaultType = 'info' @@ -25,10 +26,10 @@ const Admonition: React.FC<{ | 'exclamation' | 'lady_beetle' | 'bug' -}> = ({ title, type = defaultType, children, icon = type }) => { + | 'none' +}> = ({ title, type = defaultType, children, icon = '' }) => { const setType = typeOptions.includes(type) ? type : defaultType - const iconContent = icons[icon] || '' - + const iconContent = icon in icons ? icons[icon] : icons[setType] return (