Skip to content

Commit

Permalink
feat: 🎸 read social data from data.json
Browse files Browse the repository at this point in the history
  • Loading branch information
umutcanbolat committed Apr 22, 2022
1 parent 5a02eb2 commit 7827649
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import './App.css';
import data from './static/data.json';

function App() {
const { name, title, experiences, education, personalProjects, publications } = data;
const { name, title, social, experiences, education, personalProjects, publications } = data;

return (
<>
<section className="sheet padding-10mm">
<Header name={name} title={title} />
<Header name={name} title={title} social={social} />
<ExperienceList title="Experience" data={experiences} />
<ExperienceList title="Education" dateFormat="year" data={education} />
</section>
Expand Down
40 changes: 11 additions & 29 deletions src/components/SocialLinks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,19 @@ const StyledSocialLinks = styled.div`
}
`;

const socialData = [
{
id: 'github',
image: <FiGithub />,
text: '/umutcanbolat',
href: 'https://github.com/umutcanbolat',
},
{
id: 'linkedin',
image: <FaLinkedinIn />,
text: '/umutcanbolat',
href: 'https://www.linkedin.com/in/umutcanbolat',
},
{
id: 'web',
image: <VscGlobe />,
text: 'umutcanbolat.com',
href: 'https://www.umutcanbolat.com',
},
{
id: 'email',
image: <FiMail />,
text: '[email protected]',
href: 'mailto:[email protected]',
},
];
const socialIcons = {
github: <FiGithub />,
linkedin: <FaLinkedinIn />,
web: <VscGlobe />,
email: <FiMail />,
};

export default function SocialLinks() {
const links = socialData.map(({ id, image, text, href }) => (
const getImageComponent = (socialId) => socialIcons[socialId] || socialIcons.web;

export default function SocialLinks({ data }) {
const links = data.map(({ id, text, href }) => (
<div key={id} className="item">
<SocialItem image={image} text={text} href={href} />
<SocialItem image={getImageComponent(id)} text={text} href={href} />
</div>
));
return <StyledSocialLinks>{links}</StyledSocialLinks>;
Expand Down
4 changes: 2 additions & 2 deletions src/sections/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const StyledHeader = styled.div`
}
`;

export default function Header({ name, title }) {
export default function Header({ name, title, social }) {
return (
<StyledHeader>
<h1>{name}</h1>
<p>{title}</p>
<SocialLinks />
<SocialLinks data={social} />
</StyledHeader>
);
}
22 changes: 22 additions & 0 deletions src/static/data.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
{
"name": "Umut Canbolat",
"title": "Full-Stack Software Engineer",
"social": [
{
"id": "github",
"text": "/umutcanbolat",
"href": "https://github.com/umutcanbolat"
},
{
"id": "linkedin",
"text": "/umutcanbolat",
"href": "https://www.linkedin.com/in/umutcanbolat"
},
{
"id": "web",
"text": "umutcanbolat.com",
"href": "https://www.umutcanbolat.com"
},
{
"id": "email",
"text": "[email protected]",
"href": "mailto:[email protected]"
}
],
"experiences": [
{
"id": 1,
Expand Down

0 comments on commit 7827649

Please sign in to comment.