added markdown, organized templates, fixed email overflow issue in pikachu

This commit is contained in:
Amruth Pillai
2020-03-26 23:27:04 +05:30
parent 178d12fae9
commit 333e94cb32
12 changed files with 733 additions and 320 deletions

View File

@ -1,4 +1,6 @@
import React, { useContext } from 'react';
import ReactMarkdown from 'react-markdown';
import AppContext from '../../context/AppContext';
const Onyx = () => {
@ -6,6 +8,174 @@ const Onyx = () => {
const { state } = context;
const { data, theme } = state;
const Photo = () =>
data.profile.photo && (
<img
className="rounded object-cover mr-4"
src={data.profile.photo}
alt="Resume Photograph"
style={{ width: '120px', height: '120px' }}
/>
);
const Profile = () => (
<div>
<h1 className="font-bold text-4xl" style={{ color: theme.colors.accent }}>
{data.profile.firstName} {data.profile.lastName}
</h1>
<h6 className="font-medium text-sm">{data.profile.subtitle}</h6>
<div className="flex flex-col mt-4 text-xs">
<span>{data.profile.address.line1}</span>
<span>{data.profile.address.line2}</span>
<span>{data.profile.address.line3}</span>
</div>
</div>
);
const ContactItem = ({ icon, value }) =>
value && (
<div className="flex items-center my-3">
<span className="material-icons text-lg mr-2" style={{ color: theme.colors.accent }}>
{icon}
</span>
<span className="font-medium">{value}</span>
</div>
);
const Heading = ({ title }) => (
<h6 className="text-xs font-bold uppercase mt-6 mb-2" style={{ color: theme.colors.accent }}>
{title}
</h6>
);
const Objective = () =>
data.objective.enable && (
<div>
<Heading title={data.objective.heading} />
<ReactMarkdown className="text-sm" source={data.objective.body} />
</div>
);
const WorkItem = x => (
<div key={x.title} className="mt-3">
<div className="flex justify-between">
<div>
<h6 className="font-semibold">{x.title}</h6>
<p className="text-xs">{x.role}</p>
</div>
<span className="text-xs font-medium">
({x.start} - {x.end})
</span>
</div>
<ReactMarkdown className="mt-2 text-sm" source={x.description} />
</div>
);
const Work = () =>
data.work.enable && (
<div>
<Heading title={data.work.heading} />
{data.work.items.map(WorkItem)}
</div>
);
const EducationItem = x => (
<div key={x.name} className="mt-3">
<div className="flex justify-between">
<div>
<h6 className="font-semibold">{x.name}</h6>
<p className="text-xs">{x.major}</p>
</div>
<div className="flex flex-col items-end">
<span className="text-sm font-bold">{x.grade}</span>
<span className="text-xs font-medium">
({x.start} - {x.end})
</span>
</div>
</div>
<ReactMarkdown className="mt-2 text-sm" source={x.description} />
</div>
);
const Education = () =>
data.education.enable && (
<div>
<Heading title={data.education.heading} />
{data.education.items.map(EducationItem)}
</div>
);
const AwardItem = x => (
<div key={x.title} className="mt-3">
<h6 className="font-semibold">{x.title}</h6>
<p className="text-xs">{x.subtitle}</p>
<ReactMarkdown className="mt-2 text-sm" source={x.description} />
</div>
);
const Awards = () =>
data.awards.enable && (
<div>
<Heading title={data.awards.heading} />
{data.awards.items.map(AwardItem)}
</div>
);
const CertificationItem = x => (
<div key={x.title} className="mt-3">
<h6 className="font-semibold">{x.title}</h6>
<p className="text-xs">{x.subtitle}</p>
<ReactMarkdown className="mt-2 text-sm" source={x.description} />
</div>
);
const Certifications = () =>
data.certifications.enable && (
<div>
<Heading title={data.certifications.heading} />
{data.certifications.items.map(CertificationItem)}
</div>
);
const SkillItem = x => (
<span
key={x}
className="text-xs rounded-full px-3 py-1 font-medium my-2 mr-2"
style={{
backgroundColor: theme.colors.primary,
color: theme.colors.background,
}}
>
{x}
</span>
);
const Skills = () =>
data.skills.enable && (
<div>
<Heading title={data.skills.heading} />
<div className="mt-1 flex flex-wrap">{data.skills.items.map(SkillItem)}</div>
</div>
);
const ExtraItem = x => (
<tr key={x.key}>
<td className="border font-medium px-4 py-2 text-sm">{x.key}</td>
<td className="border px-4 py-2 text-sm">{x.value}</td>
</tr>
);
const Extras = () =>
data.extras.enable && (
<div>
<Heading title={data.extras.heading} />
<table className="w-2/3 table-auto">
<tbody>{data.extras.items.map(ExtraItem)}</tbody>
</table>
</div>
);
return (
<div
style={{
@ -16,203 +186,30 @@ const Onyx = () => {
>
<div className="grid grid-cols-4 items-center">
<div className="col-span-3 flex items-center">
{data.profile.photo && (
<img
className="rounded object-cover mr-4"
src={data.profile.photo}
alt="Resume Photograph"
style={{ width: '120px', height: '120px' }}
/>
)}
<div>
<h1 className="font-bold text-4xl" style={{ color: theme.colors.accent }}>
{data.profile.firstName} {data.profile.lastName}
</h1>
<h6 className="font-medium text-sm">{data.profile.subtitle}</h6>
<div className="flex flex-col mt-4 text-xs">
<span>{data.profile.address.line1}</span>
<span>{data.profile.address.line2}</span>
<span>{data.profile.address.line3}</span>
</div>
</div>
<Photo />
<Profile />
</div>
<div className="col-span-1 text-xs">
{data.profile.phone && (
<div className="flex items-center my-3">
<span className="material-icons text-lg mr-2" style={{ color: theme.colors.accent }}>
phone
</span>
<span className="font-medium">{data.profile.phone}</span>
</div>
)}
{data.profile.website && (
<div className="flex items-center my-3">
<span className="material-icons text-lg mr-2" style={{ color: theme.colors.accent }}>
language
</span>
<span className="font-medium">{data.profile.website}</span>
</div>
)}
{data.profile.email && (
<div className="flex items-center my-3">
<span className="material-icons text-lg mr-2" style={{ color: theme.colors.accent }}>
alternate_email
</span>
<span className="font-medium">{data.profile.email}</span>
</div>
)}
<ContactItem icon="phone" value={data.profile.phone} />
<ContactItem icon="language" value={data.profile.website} />
<ContactItem icon="alternate_email" value={data.profile.email} />
</div>
</div>
<hr className="my-6" />
{data.objective.enable && (
<div>
<h6
className="text-xs font-bold uppercase mt-6 mb-2"
style={{ color: theme.colors.accent }}
>
{data.objective.heading}
</h6>
<p className="text-sm">{data.objective.body}</p>
</div>
)}
{data.work.enable && (
<div>
<h6
className="text-xs font-bold uppercase mt-6 mb-2"
style={{ color: theme.colors.accent }}
>
{data.work.heading}
</h6>
{data.work.items.map(exp => (
<div key={exp.title} className="mt-3">
<div className="flex justify-between">
<div>
<h6 className="font-semibold">{exp.title}</h6>
<p className="text-xs">{exp.role}</p>
</div>
<span className="text-xs font-medium">
({exp.start} - {exp.end})
</span>
</div>
<p className="mt-2 text-sm">{exp.description}</p>
</div>
))}
</div>
)}
{data.education.enable && (
<div>
<h6
className="text-xs font-bold uppercase mt-6 mb-2"
style={{ color: theme.colors.accent }}
>
{data.education.heading}
</h6>
{data.education.items.map(edu => (
<div key={edu.name} className="mt-3">
<div className="flex justify-between">
<div>
<h6 className="font-semibold">{edu.name}</h6>
<p className="text-xs">{edu.major}</p>
</div>
<div className="flex flex-col items-end">
<span className="text-sm font-bold">{edu.grade}</span>
<span className="text-xs font-medium">
({edu.start} - {edu.end})
</span>
</div>
</div>
<p className="mt-2 text-sm">{edu.description}</p>
</div>
))}
</div>
)}
<Objective />
<Work />
<Education />
<div className="grid grid-cols-2">
{data.awards.enable && (
<div>
<h6
className="text-xs font-bold uppercase mt-6 mb-2"
style={{ color: theme.colors.accent }}
>
{data.awards.heading}
</h6>
{data.awards.items.map(x => (
<div key={x.title} className="mt-3">
<h6 className="font-semibold">{x.title}</h6>
<p className="text-xs">{x.subtitle}</p>
</div>
))}
</div>
)}
{data.certifications.enable && (
<div>
<h6
className="text-xs font-bold uppercase mt-6 mb-2"
style={{ color: theme.colors.accent }}
>
{data.certifications.heading}
</h6>
{data.certifications.items.map(x => (
<div key={x.title} className="mt-3">
<h6 className="font-semibold">{x.title}</h6>
<p className="text-xs">{x.subtitle}</p>
</div>
))}
</div>
)}
<Awards />
<Certifications />
</div>
{data.skills.enable && (
<div>
<h6
className="text-xs font-bold uppercase mt-6 mb-2"
style={{ color: theme.colors.accent }}
>
{data.skills.heading}
</h6>
<div className="mt-1 flex flex-wrap">
{data.skills.items.map(x => (
<span
key={x}
className="text-xs rounded-full px-3 py-1 font-medium my-2 mr-2"
style={{
backgroundColor: theme.colors.primary,
color: theme.colors.background,
}}
>
{x}
</span>
))}
</div>
</div>
)}
{data.extras.enable && (
<div>
<h6
className="text-xs font-bold uppercase mt-6 mb-2"
style={{ color: theme.colors.accent }}
>
{data.extras.heading}
</h6>
<table className="w-2/3 table-auto">
<tbody>
{data.extras.items.map(x => (
<tr key={x.key}>
<td className="border font-medium px-4 py-2 text-sm">{x.key}</td>
<td className="border px-4 py-2 text-sm">{x.value}</td>
</tr>
))}
</tbody>
</table>
</div>
)}
<Skills />
<Extras />
</div>
);
};