mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-17 02:01:29 +10:00
- implement i18n
- translation dynamic for sections - added articles for SEO
This commit is contained in:
@ -1,8 +1,12 @@
|
||||
import { get, isEmpty } from 'lodash';
|
||||
import moment from 'moment';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const getModalText = (isEditMode, type) => {
|
||||
return isEditMode ? `Edit ${type}` : `Add ${type}`;
|
||||
const { t } = useTranslation();
|
||||
return isEditMode
|
||||
? `${t('shared.buttons.edit')} ${type}`
|
||||
: `${t('shared.buttons.add')} ${type}`;
|
||||
};
|
||||
|
||||
export const safetyCheck = (section, path = 'items') => {
|
||||
@ -30,6 +34,11 @@ export const getFieldProps = (formik, schema, name) => ({
|
||||
...formik.getFieldProps(name),
|
||||
});
|
||||
|
||||
export const getUnsplashPhoto = async () => {
|
||||
const response = await fetch('https://source.unsplash.com/featured/400x600');
|
||||
return response.url;
|
||||
};
|
||||
|
||||
export const hexToRgb = (hex) => {
|
||||
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
||||
hex = hex.replace(shorthandRegex, (m, r, g, b) => r + r + g + g + b + b);
|
||||
|
||||
Reference in New Issue
Block a user