[fix]: Conditional rendering of SectionTitles

This commit is contained in:
Sarbik Betal
2020-10-12 14:56:13 +05:30
parent 5359edb4f1
commit a92167e2d3
3 changed files with 333 additions and 940 deletions
+317 -933
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -316,10 +316,12 @@ const Markdown = props => {
} }
/> />
</> </>
{isSocial(props.social) ? `<p align="left">` : ""} <br /> {isSocial(props.social) ? (
<> <>
<SectionTitle label="Connect with me:" /> <SectionTitle label="Connect with me:" />
</> {`<p align="left">`}
</>) : ""}
<br />
<> <>
<DisplaySocial <DisplaySocial
base="https://codepen.io" base="https://codepen.io"
+10 -3
View File
@@ -20,7 +20,9 @@ const MarkdownPreview = props => {
return null return null
} }
const SectionTitle = props => { const SectionTitle = props => {
if (props.label) { if (!props.visible)
return null
else if (props.label) {
return <h3 className="w-full text-lg sm:text-xl">{props.label}</h3> return <h3 className="w-full text-lg sm:text-xl">{props.label}</h3>
} }
return null return null
@@ -111,9 +113,14 @@ const MarkdownPreview = props => {
return null return null
} }
const SocialPreview = props => { const SocialPreview = props => {
let viewSocial = false;
Object.keys(props.social).forEach(key => {
if (props.social[key] && key != 'github')
viewSocial = true;
})
return ( return (
<div className="flex justify-start items-end flex-wrap"> <div className="flex justify-start items-end flex-wrap">
<SectionTitle label="Connect with me:" /> <SectionTitle label="Connect with me:" visible={viewSocial}/>
<DisplaySocial <DisplaySocial
base="https://codepen.io" base="https://codepen.io"
icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codepen.svg" icon="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/codepen.svg"
@@ -307,7 +314,7 @@ const MarkdownPreview = props => {
}) })
return listSkills.length > 0 ? ( return listSkills.length > 0 ? (
<div className="flex flex-wrap justify-start items-center"> <div className="flex flex-wrap justify-start items-center">
<SectionTitle label="Languages and Tools:" /> <SectionTitle label="Languages and Tools:" visible={true}/>
{listSkills} {listSkills}
</div> </div>
) : ( ) : (