Issue #314: Updated Celebi, Gengar, Glalie and Pikachu templates to include new birthDate field; deleted ContactE block as it is no longer used in the Celebi template.

This commit is contained in:
gianantoniopini
2020-11-10 14:01:16 +01:00
parent df4f4e2ccd
commit 0f390ab493
6 changed files with 52 additions and 76 deletions
@@ -0,0 +1,27 @@
import React, { memo, useContext } from 'react';
import PageContext from '../../../contexts/PageContext';
import { get } from 'lodash';
import Icons from '../Icons';
import { formatDate } from '../../../utils';
const BirthDateC = () => {
const { data } = useContext(PageContext);
const Icon = get(Icons, "birthdaycake");
if (data.profile.birthDate) {
return (
<div className="text-xs flex items-center">
<Icon
size="10px"
className="mr-2"
style={{ color: data.metadata.colors.background }}
/>
<span className="font-medium break-all">{formatDate({ date: data.profile.birthDate, language: data.metadata.language, includeDay: true })}</span>
</div>
);
}
return null;
}
export default memo(BirthDateC);
-72
View File
@@ -1,72 +0,0 @@
import React, { memo, useContext } from 'react';
import { useTranslation } from 'react-i18next';
import PageContext from '../../../contexts/PageContext';
import { safetyCheck } from '../../../utils';
const ContactItem = ({ value, label, link }) => {
return value ? (
<div className="flex flex-col">
<h6 className="capitalize font-semibold">{label}</h6>
{link ? (
<a href={link} target="_blank" rel="noopener noreferrer">
<span className="font-medium break-all">{value}</span>
</a>
) : (
<span className="font-medium break-all">{value}</span>
)}
</div>
) : null;
};
const ContactE = () => {
const { t } = useTranslation();
const { data, heading: Heading } = useContext(PageContext);
return (
<div>
<Heading>{t('builder.sections.profile')}</Heading>
<div className="relative w-full grid gap-2 text-xs">
<div>
<h6 className="capitalize font-semibold">
{t('shared.forms.address')}
</h6>
<div className="flex flex-col text-xs">
<span>{data.profile.address.line1}</span>
<span>{data.profile.address.line2}</span>
<span>
{data.profile.address.city} {data.profile.address.pincode}
</span>
</div>
</div>
<ContactItem
label={t('shared.forms.phone')}
value={data.profile.phone}
link={`tel:${data.profile.phone}`}
/>
<ContactItem
label={t('shared.forms.website')}
value={data.profile.website}
link={data.profile.website}
/>
<ContactItem
label={t('shared.forms.email')}
value={data.profile.email}
link={`mailto:${data.profile.email}`}
/>
{safetyCheck(data.social) &&
data.social.items.map((x) => (
<ContactItem
key={x.id}
value={x.username}
label={x.network}
link={x.url}
/>
))}
</div>
</div>
);
};
export default memo(ContactE);