From fe6df1b9b3e58d360b558926a37289cd09e62463 Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Mon, 30 Mar 2020 01:51:47 +0530 Subject: [PATCH] extracted strings from skills tab --- src/components/LeftSidebar/LeftSidebar.js | 2 +- .../LeftSidebar/tabs/Certifications.js | 2 +- src/components/LeftSidebar/tabs/Skills.js | 55 +++++++++---------- src/i18n/resources/en/leftSidebar/index.js | 2 + src/i18n/resources/en/leftSidebar/skills.json | 5 ++ 5 files changed, 36 insertions(+), 30 deletions(-) create mode 100644 src/i18n/resources/en/leftSidebar/skills.json diff --git a/src/components/LeftSidebar/LeftSidebar.js b/src/components/LeftSidebar/LeftSidebar.js index c1d4738b..32eecd58 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('Awards'); + const [currentTab, setCurrentTab] = useState('Skills'); const onChange = (key, value) => { dispatch({ type: 'on_input', diff --git a/src/components/LeftSidebar/tabs/Certifications.js b/src/components/LeftSidebar/tabs/Certifications.js index 18805d82..8e3add8e 100644 --- a/src/components/LeftSidebar/tabs/Certifications.js +++ b/src/components/LeftSidebar/tabs/Certifications.js @@ -129,7 +129,7 @@ const AddItem = ({ heading, dispatch }) => { const Item = ({ item, index, onChange, dispatch, first, last }) => { const [isOpen, setOpen] = useState(false); - const identifier = `data.certifications.items[${index}]`; + const identifier = `data.certifications.items[${index}].`; return (
diff --git a/src/components/LeftSidebar/tabs/Skills.js b/src/components/LeftSidebar/tabs/Skills.js index 08ada187..95ca1503 100644 --- a/src/components/LeftSidebar/tabs/Skills.js +++ b/src/components/LeftSidebar/tabs/Skills.js @@ -1,11 +1,14 @@ import React, { useState, useContext } from 'react'; +import { useTranslation } from 'react-i18next'; import AppContext from '../../../context/AppContext'; import Checkbox from '../../../shared/Checkbox'; import TextField from '../../../shared/TextField'; import { addItem, deleteItem } from '../../../utils'; +import ItemHeading from '../../../shared/ItemHeading'; const SkillsTab = ({ data, onChange }) => { + const { t } = useTranslation(); const context = useContext(AppContext); const { dispatch } = context; @@ -20,7 +23,7 @@ const SkillsTab = ({ data, onChange }) => {
onChange('data.skills.heading', v)} /> @@ -33,12 +36,26 @@ const SkillsTab = ({ data, onChange }) => { ))} - + ); }; -const AddItem = ({ dispatch }) => { +const Form = ({ item, onChange }) => { + const { t } = useTranslation('leftSidebar'); + + return ( + onChange(e.target.value)} + type="text" + /> + ); +}; + +const AddItem = ({ heading, dispatch }) => { const [isOpen, setOpen] = useState(false); const [item, setItem] = useState(''); @@ -52,33 +69,21 @@ const AddItem = ({ dispatch }) => { return (
-
setOpen(!isOpen)} - > -
Add Skill
- {isOpen ? 'expand_less' : 'expand_more'} -
+
-
+
- setItem(e.target.value)} - type="text" - /> +
@@ -91,15 +96,9 @@ const Item = ({ item, index, onChange, dispatch }) => { const identifier = `data.skills.items[${index}]`; return ( -
+
- onChange(`${identifier}`, e.target.value)} - type="text" - /> + onChange(identifier, v)} />