From b1cf576c5e2d46d54a996a3ae47489d7b2d9c57e Mon Sep 17 00:00:00 2001 From: Chris Thompson Date: Mon, 14 Aug 2023 15:15:59 -0700 Subject: [PATCH 1/5] Fix labels on some callout icons. --- src/components/Database/DatabaseContainer.tsx | 2 +- src/components/common/Callout.tsx | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/Database/DatabaseContainer.tsx b/src/components/Database/DatabaseContainer.tsx index 2293c71c0..507705fbf 100644 --- a/src/components/Database/DatabaseContainer.tsx +++ b/src/components/Database/DatabaseContainer.tsx @@ -60,7 +60,7 @@ export const DatabaseContainer: React.FC> = ({ {hasNewDbs && ( setDbs(databases)}> Reload diff --git a/src/components/common/Callout.tsx b/src/components/common/Callout.tsx index c0ac2659d..de612cbfa 100644 --- a/src/components/common/Callout.tsx +++ b/src/components/common/Callout.tsx @@ -24,17 +24,16 @@ import React, { ReactNode } from 'react'; import { CustomThemeProvider, CustomThemeType, Type } from '../../themes'; export interface CalloutProps { - /** Custom icon to override the default */ - icon?: string; /** Show a lighter version of the callout */ aside?: true; /** The color scheme of the callout. Defaults to 'note' */ type?: CustomThemeType; - /** Action buttons */ actions?: ReactNode; } +// Using a type from the map ensures we can apply the correct aria label in +// addition to providing easy-to-use defailts. const DEFAULT_ICON_MAP: Record = { [Type.CAUTION]: 'error', [Type.NOTE]: 'info', @@ -45,12 +44,11 @@ const DEFAULT_ICON_MAP: Record = { export const Callout: React.FC> = ({ children, - actions, - icon, aside, type = Type.NOTE, + actions, }) => { - const iconName = icon || DEFAULT_ICON_MAP[type]; + const iconName = DEFAULT_ICON_MAP[type]; const asideClass = aside ? ' Callout-aside' : ''; const classes = `Callout Callout-${type}${asideClass}`; @@ -66,7 +64,7 @@ export const Callout: React.FC> = ({ {iconName && (