mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-17 18:21:28 +10:00
Issue #314: Added BirthDate field to Profile builder and Castform template
This commit is contained in:
@ -38,6 +38,13 @@ const Profile = ({ id }) => {
|
||||
path="profile.subtitle"
|
||||
/>
|
||||
|
||||
<Input
|
||||
type="date"
|
||||
name="birthDate"
|
||||
label={t('builder.profile.birthDate')}
|
||||
path="profile.birthDate"
|
||||
/>
|
||||
|
||||
<hr />
|
||||
|
||||
<Input
|
||||
|
||||
@ -190,6 +190,7 @@
|
||||
"line2": "Brindavan Layout, Subramanyapura,",
|
||||
"pincode": "560061"
|
||||
},
|
||||
"birthDate": "",
|
||||
"email": "hello@amruthpillai.com",
|
||||
"firstName": "Amruth",
|
||||
"heading": "Profile",
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"firstName": "",
|
||||
"lastName": "",
|
||||
"subtitle": "",
|
||||
"birthDate": "",
|
||||
"address": {
|
||||
"line1": "",
|
||||
"line2": "",
|
||||
|
||||
@ -96,6 +96,7 @@
|
||||
"photograph": "Photograph",
|
||||
"firstName": "First Name",
|
||||
"lastName": "Last Name",
|
||||
"birthDate": "Date of Birth",
|
||||
"address": {
|
||||
"line1": "Address Line 1",
|
||||
"line2": "Address Line 2",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import PageContext from '../contexts/PageContext';
|
||||
import AwardsA from './blocks/Awards/AwardsA';
|
||||
import CertificationsA from './blocks/Certifications/CertificationsA';
|
||||
@ -12,6 +13,7 @@ import ProjectsA from './blocks/Projects/ProjectsA';
|
||||
import ReferencesA from './blocks/References/ReferencesA';
|
||||
import SkillsA from './blocks/Skills/SkillsA';
|
||||
import WorkA from './blocks/Work/WorkA';
|
||||
import { formatDate } from '../utils';
|
||||
|
||||
const Blocks = {
|
||||
objective: ObjectiveA,
|
||||
@ -26,7 +28,8 @@ const Blocks = {
|
||||
references: ReferencesA,
|
||||
};
|
||||
|
||||
const Castform = ({ data }) => {
|
||||
const Castform = ({ data, language }) => {
|
||||
const { t } = useTranslation();
|
||||
const layout = data.metadata.layout.castform;
|
||||
|
||||
const Photo = () =>
|
||||
@ -51,6 +54,19 @@ const Castform = ({ data }) => {
|
||||
</div>
|
||||
);
|
||||
|
||||
const BirthDate = () => (
|
||||
data.profile.birthDate && (
|
||||
<div className="text-xs">
|
||||
<h6 className="capitalize font-semibold">
|
||||
{t('builder.profile.birthDate')}
|
||||
</h6>
|
||||
<div>
|
||||
<span>{formatDate({ date: data.profile.birthDate, language, includeDay: true })}</span>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
|
||||
return (
|
||||
<PageContext.Provider value={{ data, heading: HeadingD }}>
|
||||
<div
|
||||
@ -76,7 +92,10 @@ const Castform = ({ data }) => {
|
||||
|
||||
<div>
|
||||
<HeadingD>{data.profile.heading}</HeadingD>
|
||||
<ContactC />
|
||||
<div className="grid gap-4">
|
||||
<BirthDate />
|
||||
<ContactC />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{layout[0] &&
|
||||
|
||||
@ -20,8 +20,11 @@ export const isFileImage = (file) => {
|
||||
return file && acceptedImageTypes.includes(file.type);
|
||||
};
|
||||
|
||||
export const formatDate = ({ date, language = 'en' }) => {
|
||||
return dayjs(date).locale(language.substr(0, 2)).format('MMMM YYYY');
|
||||
export const formatDate = ({ date, language = 'en', includeDay = false }) => {
|
||||
const monthYearTemplate = 'MMMM YYYY';
|
||||
const template = includeDay ? 'DD ' + monthYearTemplate : monthYearTemplate;
|
||||
|
||||
return dayjs(date).locale(language.substr(0, 2)).format(template);
|
||||
};
|
||||
|
||||
export const formatDateRange = ({ startDate, endDate, language = 'en' }, t) => {
|
||||
|
||||
Reference in New Issue
Block a user