diff --git a/src/components/LeftSidebar/LeftSidebar.js b/src/components/LeftSidebar/LeftSidebar.js
index f449e872..985dd434 100644
--- a/src/components/LeftSidebar/LeftSidebar.js
+++ b/src/components/LeftSidebar/LeftSidebar.js
@@ -31,7 +31,7 @@ const LeftSidebar = () => {
const { state, dispatch } = context;
const { data } = state;
- const [currentTab, setCurrentTab] = useState('Languages');
+ const [currentTab, setCurrentTab] = useState('References');
const onChange = (key, value) => {
dispatch({
type: 'on_input',
diff --git a/src/components/LeftSidebar/tabs/References.js b/src/components/LeftSidebar/tabs/References.js
index 8e4d2b37..2a4c3db8 100644
--- a/src/components/LeftSidebar/tabs/References.js
+++ b/src/components/LeftSidebar/tabs/References.js
@@ -1,4 +1,5 @@
import React, { useState, useEffect, useContext } from 'react';
+import { useTranslation } from 'react-i18next';
import { v4 as uuidv4 } from 'uuid';
import set from 'lodash/set';
@@ -6,10 +7,13 @@ import TextField from '../../../shared/TextField';
import TextArea from '../../../shared/TextArea';
import AppContext from '../../../context/AppContext';
import Checkbox from '../../../shared/Checkbox';
-import { addItem, deleteItem, moveItemUp, moveItemDown } from '../../../utils';
+import { addItem } from '../../../utils';
import ItemActions from '../../../shared/ItemActions';
+import ItemHeading from '../../../shared/ItemHeading';
+import AddItemButton from '../../../shared/AddItemButton';
const ReferencesTab = ({ data, onChange }) => {
+ const { t } = useTranslation();
const context = useContext(AppContext);
const { dispatch } = context;
@@ -43,7 +47,7 @@ const ReferencesTab = ({ data, onChange }) => {
onChange('data.references.heading', v)}
/>
@@ -64,13 +68,62 @@ const ReferencesTab = ({ data, onChange }) => {
/>
))}
-
+
>
)
);
};
-const AddItem = ({ dispatch }) => {
+const Form = ({ item, onChange, identifier = '' }) => {
+ const { t } = useTranslation(['leftSidebar', 'app']);
+
+ return (
+
+ onChange(`${identifier}name`, v)}
+ />
+
+ onChange(`${identifier}position`, v)}
+ />
+
+ onChange(`${identifier}phone`, v)}
+ />
+
+ onChange(`${identifier}email`, v)}
+ />
+
+
+ );
+};
+
+const AddItem = ({ heading, dispatch }) => {
const [isOpen, setOpen] = useState(false);
const [item, setItem] = useState({
id: uuidv4(),
@@ -104,66 +157,12 @@ const AddItem = ({ dispatch }) => {
return (
-
setOpen(!isOpen)}
- >
-
Add Reference
- {isOpen ? 'expand_less' : 'expand_more'}
-
+
-
onChange('name', v)}
- />
+
- onChange('position', v)}
- />
-
- onChange('phone', v)}
- />
-
- onChange('email', v)}
- />
-
-
);
@@ -171,71 +170,23 @@ const AddItem = ({ dispatch }) => {
const Item = ({ item, index, onChange, dispatch, first, last }) => {
const [isOpen, setOpen] = useState(false);
- const identifier = `data.references.items[${index}]`;
+ const identifier = `data.references.items[${index}].`;
return (
-
setOpen(!isOpen)}
- >
-
{item.name}
- {isOpen ? 'expand_less' : 'expand_more'}
-
+
- onChange(`${identifier}.name`, v)}
- />
-
- onChange(`${identifier}.position`, v)}
- />
-
- onChange(`${identifier}.phone`, v)}
- />
-
- onChange(`${identifier}.email`, v)}
- />
-
-
diff --git a/src/i18n/resources/en/leftSidebar/index.js b/src/i18n/resources/en/leftSidebar/index.js
index be065cba..c29ac98b 100644
--- a/src/i18n/resources/en/leftSidebar/index.js
+++ b/src/i18n/resources/en/leftSidebar/index.js
@@ -6,6 +6,7 @@ import awards from './awards.json';
import certifications from './certifications.json';
import skills from './skills.json';
import languages from './languages.json';
+import references from './references.json';
export default {
profile,
@@ -16,4 +17,5 @@ export default {
certifications,
skills,
languages,
+ references,
};
diff --git a/src/i18n/resources/en/leftSidebar/references.json b/src/i18n/resources/en/leftSidebar/references.json
new file mode 100644
index 00000000..1cb5db52
--- /dev/null
+++ b/src/i18n/resources/en/leftSidebar/references.json
@@ -0,0 +1,21 @@
+{
+ "name": {
+ "label": "Name",
+ "placeholder": "Richard Hendricks"
+ },
+ "position": {
+ "label": "Position",
+ "placeholder": "CEO, Pied Piper"
+ },
+ "phone": {
+ "label": "Phone Number",
+ "placeholder": "+1 123 456 7890"
+ },
+ "email": {
+ "label": "Email Address",
+ "placeholder": "richard@piedpiper.com"
+ },
+ "description": {
+ "placeholder": "You can write about how you and the reference contact worked together and which projects you were a part of."
+ }
+}