Badge: fix page crash when color isn't defined
Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1650
This commit is contained in:
parent
1518615767
commit
b86da5f426
1 changed files with 3 additions and 1 deletions
|
@ -13,7 +13,9 @@ const Badge: React.FC<IBadge> = ({ title, slug, color }) => {
|
|||
const fallback = !['patron', 'admin', 'moderator', 'opaque', 'badge:donor'].includes(slug);
|
||||
|
||||
const isDark = useMemo(() => {
|
||||
const hsl = hexToHsl(color!);
|
||||
if (!color) return false;
|
||||
|
||||
const hsl = hexToHsl(color);
|
||||
|
||||
if (hsl && hsl.l > 50) return false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue