import React, { useState, useContext } from 'react'; import AppContext from '../../../context/AppContext'; import Checkbox from '../../../shared/Checkbox'; import TextField from '../../../shared/TextField'; import { addItem, deleteItem, moveItemUp, moveItemDown } from '../../../utils'; import ItemHeading from '../../../shared/ItemHeading'; const SkillsTab = ({ data, onChange }) => { const context = useContext(AppContext); const { dispatch } = context; return ( <>
onChange('data.skills.enable', v)} />
onChange('data.skills.heading', v)} />

{data.skills.items.map((x, index) => ( ))} ); }; const Form = ({ item, onChange }) => { return ( onChange(e.target.value)} type="text" /> ); }; const AddItem = ({ heading, dispatch }) => { const [isOpen, setOpen] = useState(false); const [item, setItem] = useState(''); const add = () => { if (item === '') return; addItem(dispatch, 'skills', item); setItem(''); }; return (
); }; const Item = ({ item, index, onChange, dispatch }) => { const identifier = `data.skills.items[${index}]`; return (
onChange(identifier, v)} />
); }; export default SkillsTab;