mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-17 02:01:29 +10:00
- implementing hobby, language and reference sections
- dynamic template selection
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
import { get } from 'lodash';
|
||||
import moment from 'moment';
|
||||
|
||||
export const getModalText = (isEditMode, type) => {
|
||||
return isEditMode ? `Edit ${type}` : `Add ${type}`;
|
||||
};
|
||||
@ -8,7 +11,7 @@ export const transformCollectionSnapshot = (snapshot, setData) => {
|
||||
setData(data);
|
||||
};
|
||||
|
||||
export const handleKeyDown = (event, action) => {
|
||||
export const handleKeyUp = (event, action) => {
|
||||
(event.which === 13 || event.which === 32) && action();
|
||||
};
|
||||
|
||||
@ -16,3 +19,15 @@ export const isFileImage = (file) => {
|
||||
const acceptedImageTypes = ['image/jpeg', 'image/png'];
|
||||
return file && acceptedImageTypes.includes(file.type);
|
||||
};
|
||||
|
||||
export const formatDateRange = (x) =>
|
||||
`${moment(x.startDate).format('MMMM Y')} — ${
|
||||
moment(x.endDate).isValid() ? moment(x.endDate).format('MMMM Y') : 'Present'
|
||||
}`;
|
||||
|
||||
export const getFieldProps = (formik, schema, name) => ({
|
||||
touched: get(formik, `touched.${name}`, false),
|
||||
error: get(formik, `errors.${name}`, ''),
|
||||
isRequired: get(schema, `fields.${name}._exclusive.required`),
|
||||
...formik.getFieldProps(name),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user