From 518fa85aac677db9cc3ec95814a960cd3b68d8bd Mon Sep 17 00:00:00 2001 From: Timothy Stewart Date: Wed, 24 Nov 2021 12:47:23 -0600 Subject: [PATCH] fix(custom buttons): more null checking; fix display name; add alt --- src/components/Button/Button.js | 3 +- src/components/Home/Home.js | 45 +++++++++++++------ .../__test__/__snapshots__/Sort.test.js.snap | 4 ++ yarn.lock | 40 ++++++++--------- 4 files changed, 58 insertions(+), 34 deletions(-) diff --git a/src/components/Button/Button.js b/src/components/Button/Button.js index 6b23ae1..c871c60 100644 --- a/src/components/Button/Button.js +++ b/src/components/Button/Button.js @@ -5,7 +5,7 @@ import { runtimeConfig } from '../../config'; import { trackUmamiEvent } from '../../analytics/umami'; function Button(props) { - const { name, href, displayName, logo, styles } = props; + const { name, href, displayName, logo, styles, alt } = props; const handleClick = () => { const eventName = `${name}-button`; @@ -27,6 +27,7 @@ function Button(props) { rel="noopener noreferrer" onClick={handleClick} style={styles ? styles : undefined} + title={alt || displayName} > {logo && ( {`${displayName} diff --git a/src/components/Home/Home.js b/src/components/Home/Home.js index 4eb88ef..d0c0003 100644 --- a/src/components/Home/Home.js +++ b/src/components/Home/Home.js @@ -61,19 +61,38 @@ function Home(props) { const buttonColors = runtimeConfig.CUSTOM_BUTTON_COLOR?.split(','); const textColors = runtimeConfig.CUSTOM_BUTTON_TEXT_COLOR?.split(','); // have to clean up some of the strings to standardize for analytics - return texts.map((t, i) => ( -