diff --git a/packages/web/components/patterns/LibraryCards/FallbackImage.tsx b/packages/web/components/patterns/LibraryCards/FallbackImage.tsx index 83edd385c..b1c8bbd48 100644 --- a/packages/web/components/patterns/LibraryCards/FallbackImage.tsx +++ b/packages/web/components/patterns/LibraryCards/FallbackImage.tsx @@ -7,20 +7,30 @@ type FallbackImageProps = { fontSize: string } -export const FallbackImage = (props: FallbackImageProps): JSX.Element => { - const idx = (Math.abs(hashCode(props.title)) % Colors.length) - 1 - const color = Colors[idx] +const colorsForStr = (str: string): string[] => { + try { + const idx = Math.abs(hashCode(str)) % (Colors.length - 1) + const color = Colors[idx] + if (color.colors[0] && color.colors[1]) { + return color.colors + } + } catch (err) { + console.log('error creating colors for', str) + } + return Colors[0].colors +} +export const FallbackImage = (props: FallbackImageProps): JSX.Element => { + const colors = colorsForStr(props.title) return ( { return ( - + { { {props.item.title} @@ -244,7 +244,7 @@ const LibraryGridCardContent = (props: LinkedItemCardProps): JSX.Element => { css={{ ...AuthorInfoStyle, mt: '5px', - mb: '10px', + mb: '20px', }} > {props.item.author}