Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"homepage": "https://github.com/harish-sethuraman/readme-components#readme",
"dependencies": {
"node-fetch": "^2.6.0",
"simple-icons": "^3.5.0"
"simple-icons": "^15.5.0"
}
}
24 changes: 12 additions & 12 deletions src/logo-component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const faultComponent = require("../fault-component");
const logoComponent = (data = {}) => {
const { logo, fill, text, textfill, animation, svgfill, desc, scale } = data;

if (!logo.match(/^[a-z]*$/) || simpleIcons.get(logo) != undefined) {
const iconName = `si${logo.charAt(0).toUpperCase() + logo.slice(1)}`;
const icon = simpleIcons[iconName];

if (icon != undefined) {
return `
<svg height="${scale != undefined ? 60 * scale : "60"}" width="${
scale == undefined
Expand All @@ -26,7 +29,7 @@ const logoComponent = (data = {}) => {
}`
}" xmlns="http://www.w3.org/2000/svg">
<style>
${logoComponentStyles(fill, textfill, animation, svgfill)}
${logoComponentStyles(fill, textfill, animation, svgfill )}
</style>
<foreignObject style="transform:scale(${scale})" height="60" width="${
text == "false"
Expand All @@ -39,17 +42,13 @@ const logoComponent = (data = {}) => {
}">
<div class="gradient-btn btn-color" xmlns="http://www.w3.org/1999/xhtml">
<div class="svg">
${simpleIcons.get(`${logo}`) != undefined ? simpleIcons.get(logo).svg : logo}
${icon.svg}
</div>
${
simpleIcons.get(logo) != undefined
? text != "false"
? desc != undefined
? `<div class="text"><div>${desc}</div></div>`
: `<div class="text"><div>${logo}</div></div>`
: ""
: desc != undefined && text != false
? `<div class="text"><div>${desc}</div></div>`
text != "false"
? desc != undefined
? `<div class="text"><div>${desc}</div></div>`
: `<div class="text"><div>${logo}</div></div>`
: ""
}
</div>
Expand All @@ -58,7 +57,8 @@ ${

`;
} else {
return faultComponent();
return faultComponent( );
}
};
module.exports = logoComponent;