mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-13 16:22:59 +10:00
extracted strings from awards tab
This commit is contained in:
@ -31,7 +31,7 @@ const LeftSidebar = () => {
|
|||||||
const { state, dispatch } = context;
|
const { state, dispatch } = context;
|
||||||
const { data } = state;
|
const { data } = state;
|
||||||
|
|
||||||
const [currentTab, setCurrentTab] = useState('Education');
|
const [currentTab, setCurrentTab] = useState('Awards');
|
||||||
const onChange = (key, value) => {
|
const onChange = (key, value) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'on_input',
|
type: 'on_input',
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import React, { useState, useContext } from 'react';
|
import React, { useState, useContext } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import set from 'lodash/set';
|
import set from 'lodash/set';
|
||||||
|
|
||||||
@ -8,8 +9,11 @@ import Checkbox from '../../../shared/Checkbox';
|
|||||||
import TextArea from '../../../shared/TextArea';
|
import TextArea from '../../../shared/TextArea';
|
||||||
import { addItem, deleteItem, moveItemUp, moveItemDown } from '../../../utils';
|
import { addItem, deleteItem, moveItemUp, moveItemDown } from '../../../utils';
|
||||||
import ItemActions from '../../../shared/ItemActions';
|
import ItemActions from '../../../shared/ItemActions';
|
||||||
|
import AddItemButton from '../../../shared/AddItemButton';
|
||||||
|
import ItemHeading from '../../../shared/ItemHeading';
|
||||||
|
|
||||||
const AwardsTab = ({ data, onChange }) => {
|
const AwardsTab = ({ data, onChange }) => {
|
||||||
|
const { t } = useTranslation('app');
|
||||||
const context = useContext(AppContext);
|
const context = useContext(AppContext);
|
||||||
const { dispatch } = context;
|
const { dispatch } = context;
|
||||||
|
|
||||||
@ -24,7 +28,7 @@ const AwardsTab = ({ data, onChange }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="col-span-5">
|
<div className="col-span-5">
|
||||||
<TextField
|
<TextField
|
||||||
placeholder="Heading"
|
placeholder={t('heading.placeholder')}
|
||||||
value={data.awards.heading}
|
value={data.awards.heading}
|
||||||
onChange={v => onChange('data.awards.heading', v)}
|
onChange={v => onChange('data.awards.heading', v)}
|
||||||
/>
|
/>
|
||||||
@ -45,12 +49,44 @@ const AwardsTab = ({ data, onChange }) => {
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
<AddItem dispatch={dispatch} />
|
<AddItem heading={data.awards.heading} dispatch={dispatch} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const AddItem = ({ dispatch }) => {
|
const Form = ({ item, onChange, identifier = '' }) => {
|
||||||
|
const { t } = useTranslation(['leftSidebar', 'app']);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<TextField
|
||||||
|
className="mb-6"
|
||||||
|
label={t('awards.title.label')}
|
||||||
|
placeholder={t('awards.title.placeholder')}
|
||||||
|
value={item.title}
|
||||||
|
onChange={v => onChange(`${identifier}title`, v)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-6"
|
||||||
|
label={t('awards.subtitle.label')}
|
||||||
|
placeholder={t('awards.subtitle.placeholder')}
|
||||||
|
value={item.subtitle}
|
||||||
|
onChange={v => onChange(`${identifier}subtitle`, v)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextArea
|
||||||
|
className="mb-6"
|
||||||
|
label={t('app:item.description.label')}
|
||||||
|
placeholder={t('awards.description.placeholder')}
|
||||||
|
value={item.description}
|
||||||
|
onChange={v => onChange(`${identifier}description`, v)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const AddItem = ({ heading, dispatch }) => {
|
||||||
const [isOpen, setOpen] = useState(false);
|
const [isOpen, setOpen] = useState(false);
|
||||||
const [item, setItem] = useState({
|
const [item, setItem] = useState({
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
@ -80,48 +116,12 @@ const AddItem = ({ dispatch }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="my-4 border border-gray-200 rounded p-5">
|
<div className="my-4 border border-gray-200 rounded p-5">
|
||||||
<div
|
<ItemHeading heading={heading} setOpen={setOpen} isOpen={isOpen} />
|
||||||
className="flex justify-between items-center cursor-pointer"
|
|
||||||
onClick={() => setOpen(!isOpen)}
|
|
||||||
>
|
|
||||||
<h6 className="text-sm font-medium">Add Award</h6>
|
|
||||||
<i className="material-icons">{isOpen ? 'expand_less' : 'expand_more'}</i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
||||||
<TextField
|
<Form item={item} onChange={onChange} />
|
||||||
label="Title"
|
|
||||||
className="mb-6"
|
|
||||||
placeholder="Math & Science Olympiad"
|
|
||||||
value={item.title}
|
|
||||||
onChange={v => onChange('title', v)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextField
|
<AddItemButton onSubmit={onSubmit} />
|
||||||
label="Subtitle"
|
|
||||||
className="mb-6"
|
|
||||||
placeholder="First Place, International Level"
|
|
||||||
value={item.subtitle}
|
|
||||||
onChange={v => onChange('subtitle', v)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextArea
|
|
||||||
label="Description"
|
|
||||||
className="mb-6"
|
|
||||||
value={item.description}
|
|
||||||
onChange={v => onChange('description', v)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={onSubmit}
|
|
||||||
className="bg-gray-600 hover:bg-gray-700 text-white text-sm font-medium py-2 px-5 rounded"
|
|
||||||
>
|
|
||||||
<div className="flex items-center">
|
|
||||||
<i className="material-icons mr-2 font-bold text-base">add</i>
|
|
||||||
<span className="text-sm">Add</span>
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -129,41 +129,14 @@ const AddItem = ({ dispatch }) => {
|
|||||||
|
|
||||||
const Item = ({ item, index, onChange, dispatch, first, last }) => {
|
const Item = ({ item, index, onChange, dispatch, first, last }) => {
|
||||||
const [isOpen, setOpen] = useState(false);
|
const [isOpen, setOpen] = useState(false);
|
||||||
const identifier = `data.awards.items[${index}]`;
|
const identifier = `data.awards.items[${index}].`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="my-4 border border-gray-200 rounded p-5">
|
<div className="my-4 border border-gray-200 rounded p-5">
|
||||||
<div
|
<ItemHeading title={item.title} setOpen={setOpen} isOpen={isOpen} />
|
||||||
className="flex justify-between items-center cursor-pointer"
|
|
||||||
onClick={() => setOpen(!isOpen)}
|
|
||||||
>
|
|
||||||
<h6 className="text-sm font-medium">{item.title}</h6>
|
|
||||||
<i className="material-icons">{isOpen ? 'expand_less' : 'expand_more'}</i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
||||||
<TextField
|
<Form item={item} onChange={onChange} identifier={identifier} />
|
||||||
label="Title"
|
|
||||||
className="mb-6"
|
|
||||||
placeholder="Math & Science Olympiad"
|
|
||||||
value={item.title}
|
|
||||||
onChange={v => onChange(`${identifier}.title`, v)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextField
|
|
||||||
label="Subtitle"
|
|
||||||
className="mb-6"
|
|
||||||
placeholder="First Place, International Level"
|
|
||||||
value={item.subtitle}
|
|
||||||
onChange={v => onChange(`${identifier}.subtitle`, v)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextArea
|
|
||||||
label="Description"
|
|
||||||
className="mb-6"
|
|
||||||
value={item.description}
|
|
||||||
onChange={v => onChange(`${identifier}.description`, v)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ItemActions
|
<ItemActions
|
||||||
item={item}
|
item={item}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import Checkbox from '../../../shared/Checkbox';
|
|||||||
import { addItem } from '../../../utils';
|
import { addItem } from '../../../utils';
|
||||||
import ItemActions from '../../../shared/ItemActions';
|
import ItemActions from '../../../shared/ItemActions';
|
||||||
import AddItemButton from '../../../shared/AddItemButton';
|
import AddItemButton from '../../../shared/AddItemButton';
|
||||||
|
import ItemHeading from '../../../shared/ItemHeading';
|
||||||
|
|
||||||
const EducationTab = ({ data, onChange }) => {
|
const EducationTab = ({ data, onChange }) => {
|
||||||
const { t } = useTranslation('app');
|
const { t } = useTranslation('app');
|
||||||
@ -113,7 +114,6 @@ const Form = ({ item, onChange, identifier = '' }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const AddItem = ({ heading, dispatch }) => {
|
const AddItem = ({ heading, dispatch }) => {
|
||||||
const { t } = useTranslation('app');
|
|
||||||
const [isOpen, setOpen] = useState(false);
|
const [isOpen, setOpen] = useState(false);
|
||||||
const [item, setItem] = useState({
|
const [item, setItem] = useState({
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
@ -136,7 +136,7 @@ const AddItem = ({ heading, dispatch }) => {
|
|||||||
setItem({
|
setItem({
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
enable: true,
|
enable: true,
|
||||||
title: '',
|
name: '',
|
||||||
role: '',
|
role: '',
|
||||||
start: '',
|
start: '',
|
||||||
end: '',
|
end: '',
|
||||||
@ -149,13 +149,7 @@ const AddItem = ({ heading, dispatch }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="my-4 border border-gray-200 rounded p-5">
|
<div className="my-4 border border-gray-200 rounded p-5">
|
||||||
<div
|
<ItemHeading heading={heading} setOpen={setOpen} isOpen={isOpen} />
|
||||||
className="flex justify-between items-center cursor-pointer"
|
|
||||||
onClick={() => setOpen(!isOpen)}
|
|
||||||
>
|
|
||||||
<h6 className="text-sm font-medium">{t('item.addHeading', { heading })}</h6>
|
|
||||||
<i className="material-icons">{isOpen ? 'expand_less' : 'expand_more'}</i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
||||||
<Form item={item} onChange={onChange} />
|
<Form item={item} onChange={onChange} />
|
||||||
@ -171,13 +165,7 @@ const Item = ({ item, index, onChange, dispatch, first, last }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="my-4 border border-gray-200 rounded p-5">
|
<div className="my-4 border border-gray-200 rounded p-5">
|
||||||
<div
|
<ItemHeading title={item.name} setOpen={setOpen} isOpen={isOpen} />
|
||||||
className="flex justify-between items-center cursor-pointer"
|
|
||||||
onClick={() => setOpen(!isOpen)}
|
|
||||||
>
|
|
||||||
<h6 className="text-sm font-medium">{item.name}</h6>
|
|
||||||
<i className="material-icons">{isOpen ? 'expand_less' : 'expand_more'}</i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
||||||
<Form item={item} onChange={onChange} identifier={identifier} />
|
<Form item={item} onChange={onChange} identifier={identifier} />
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import Checkbox from '../../../shared/Checkbox';
|
|||||||
import { addItem } from '../../../utils';
|
import { addItem } from '../../../utils';
|
||||||
import ItemActions from '../../../shared/ItemActions';
|
import ItemActions from '../../../shared/ItemActions';
|
||||||
import AddItemButton from '../../../shared/AddItemButton';
|
import AddItemButton from '../../../shared/AddItemButton';
|
||||||
|
import ItemHeading from '../../../shared/ItemHeading';
|
||||||
|
|
||||||
const WorkTab = ({ data, onChange }) => {
|
const WorkTab = ({ data, onChange }) => {
|
||||||
const { t } = useTranslation('app');
|
const { t } = useTranslation('app');
|
||||||
@ -102,8 +103,6 @@ const Form = ({ item, onChange, identifier = '' }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const AddItem = ({ heading, dispatch }) => {
|
const AddItem = ({ heading, dispatch }) => {
|
||||||
const { t } = useTranslation('app');
|
|
||||||
|
|
||||||
const [isOpen, setOpen] = useState(false);
|
const [isOpen, setOpen] = useState(false);
|
||||||
const [item, setItem] = useState({
|
const [item, setItem] = useState({
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
@ -137,16 +136,11 @@ const AddItem = ({ heading, dispatch }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="my-4 border border-gray-200 rounded p-5">
|
<div className="my-4 border border-gray-200 rounded p-5">
|
||||||
<div
|
<ItemHeading heading={heading} setOpen={setOpen} isOpen={isOpen} />
|
||||||
className="flex justify-between items-center cursor-pointer"
|
|
||||||
onClick={() => setOpen(!isOpen)}
|
|
||||||
>
|
|
||||||
<h6 className="text-sm font-medium">{t('item.addHeading', { heading })}</h6>
|
|
||||||
<i className="material-icons">{isOpen ? 'expand_less' : 'expand_more'}</i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
||||||
<Form item={item} onChange={onChange} />
|
<Form item={item} onChange={onChange} />
|
||||||
|
|
||||||
<AddItemButton onSubmit={onSubmit} />
|
<AddItemButton onSubmit={onSubmit} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -159,13 +153,7 @@ const Item = ({ item, index, onChange, dispatch, first, last }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="my-4 border border-gray-200 rounded p-5">
|
<div className="my-4 border border-gray-200 rounded p-5">
|
||||||
<div
|
<ItemHeading title={item.title} setOpen={setOpen} isOpen={isOpen} />
|
||||||
className="flex justify-between items-center cursor-pointer"
|
|
||||||
onClick={() => setOpen(!isOpen)}
|
|
||||||
>
|
|
||||||
<h6 className="ml-2 text-sm font-medium">{item.title}</h6>
|
|
||||||
<i className="material-icons">{isOpen ? 'expand_less' : 'expand_more'}</i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
<div className={`mt-6 ${isOpen ? 'block' : 'hidden'}`}>
|
||||||
<Form item={item} onChange={onChange} identifier={identifier} />
|
<Form item={item} onChange={onChange} identifier={identifier} />
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
"placeholder": "Heading"
|
"placeholder": "Heading"
|
||||||
},
|
},
|
||||||
"item": {
|
"item": {
|
||||||
"addHeading": "Add {{heading}}",
|
"add": "Add {{- heading}}",
|
||||||
"startDate": {
|
"startDate": {
|
||||||
"label": "Start Date",
|
"label": "Start Date",
|
||||||
"placeholder": "March 2018"
|
"placeholder": "March 2018"
|
||||||
|
|||||||
13
src/i18n/resources/en/leftSidebar/awards.json
Normal file
13
src/i18n/resources/en/leftSidebar/awards.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"title": {
|
||||||
|
"label": "Title",
|
||||||
|
"placeholder": "Math & Science Olympiad"
|
||||||
|
},
|
||||||
|
"subtitle": {
|
||||||
|
"label": "Subtitle",
|
||||||
|
"placeholder": "First Place, International Level"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"placeholder": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,10 +2,12 @@ import profile from './profile.json';
|
|||||||
import objective from './objective.json';
|
import objective from './objective.json';
|
||||||
import work from './work.json';
|
import work from './work.json';
|
||||||
import education from './education.json';
|
import education from './education.json';
|
||||||
|
import awards from './awards.json';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
profile,
|
profile,
|
||||||
objective,
|
objective,
|
||||||
work,
|
work,
|
||||||
education,
|
education,
|
||||||
|
awards,
|
||||||
};
|
};
|
||||||
|
|||||||
20
src/shared/ItemHeading.js
Normal file
20
src/shared/ItemHeading.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
const ItemHeading = ({ title, heading, isOpen, setOpen }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="flex justify-between items-center cursor-pointer"
|
||||||
|
onClick={() => setOpen(!isOpen)}
|
||||||
|
>
|
||||||
|
<h6 className="text-sm font-medium">
|
||||||
|
{typeof heading === 'undefined' ? title : t('item.add', { heading })}
|
||||||
|
</h6>
|
||||||
|
<i className="material-icons">{isOpen ? 'expand_less' : 'expand_more'}</i>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ItemHeading;
|
||||||
Reference in New Issue
Block a user