aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-11-30 23:51:04 -0500
committerBobby <[email protected]>2022-11-30 23:51:04 -0500
commit0f80dfad010020b0e26e5bfc6c7f5c621a6be6e9 (patch)
tree2efdc26772fd889ee623714b549f1837952e8cb2
parentdaaa789068cebb5fdfcea6197ade6e663be46e0f (diff)
downloadtcssocialify-0f80dfad010020b0e26e5bfc6c7f5c621a6be6e9.tar.xz
tcssocialify-0f80dfad010020b0e26e5bfc6c7f5c621a6be6e9.zip
Show Github Image if no language present
-rw-r--r--common/helpers.ts4
-rw-r--r--src/components/preview/card.tsx13
2 files changed, 16 insertions, 1 deletions
diff --git a/common/helpers.ts b/common/helpers.ts
index 029df25..208b3f6 100644
--- a/common/helpers.ts
+++ b/common/helpers.ts
@@ -96,7 +96,9 @@ const getSimpleIconsImageURI = function (language: string, theme: Theme) {
const icon = LANGUAGE_ICON_MAPPING[language]
if (!icon) return undefined
- const iconColor = theme === Theme.light ? `#${icon.hex}` : `#${icon.hex}`
+ const iconColor =
+ language === 'GitHub' && theme === Theme.dark ? '#fff' : `#${icon.hex}`
+
const iconSvg = icon.svg.replace('<svg ', `<svg fill="${iconColor}" `)
return `data:image/svg+xml,${encodeURIComponent(iconSvg)}`
diff --git a/src/components/preview/card.tsx b/src/components/preview/card.tsx
index a5ddf5c..e584880 100644
--- a/src/components/preview/card.tsx
+++ b/src/components/preview/card.tsx
@@ -32,6 +32,7 @@ const Card = (config: Configuration) => {
: nameLength > 25
? '30px'
: '40px'
+ console.log(config.theme)
return (
<div
@@ -96,6 +97,18 @@ const Card = (config: Configuration) => {
}}
/>
)}
+ {/* show github logo if no language is selected */}
+ {!languageIconImageURI && !language2IconImageURI && (
+ <img
+ src={config.logo || getSimpleIconsImageURI('GitHub', config.theme)}
+ alt="Logo"
+ width={100}
+ height={100}
+ style={{
+ objectFit: 'contain'
+ }}
+ />
+ )}
</div>
{/* Name */}