This commit is contained in:
parent
db0b4fd866
commit
f5e4738c2e
|
|
@ -2,19 +2,17 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Tabs, Space } from 'antd';
|
import { Tabs, Space } from 'antd';
|
||||||
import { CopyOutlined } from '@ant-design/icons';
|
import { CopyOutlined } from '@ant-design/icons';
|
||||||
import { toast } from 'react-toastify';
|
|
||||||
import { FormikValues, useFormikContext } from 'formik';
|
import { FormikValues, useFormikContext } from 'formik';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { AttributeTabs } from './AttributeTabs';
|
|
||||||
import { AttributeTabs as AddAttributeTabs} from '../../Add/AttributeTab/AttributeTabs';
|
import { AttributeTabs as AddAttributeTabs} from '../../Add/AttributeTab/AttributeTabs';
|
||||||
|
import { MdOutlineDeleteOutline } from 'react-icons/md';
|
||||||
|
|
||||||
const { TabPane } = Tabs;
|
|
||||||
|
|
||||||
export const TabsContainer: React.FC = () => {
|
export const TabsContainer: React.FC = () => {
|
||||||
const [activeKey, setActiveKey] = useState('1');
|
const [activeKey, setActiveKey] = useState('1');
|
||||||
const { setFieldValue } = useFormikContext();
|
const { setFieldValue } = useFormikContext();
|
||||||
const formikContext = useFormikContext<FormikValues>();
|
const formikContext = useFormikContext<FormikValues>();
|
||||||
const { values, handleChange } = formikContext;
|
const { values } = formikContext;
|
||||||
const [width, setWidth] = useState(window.innerWidth);
|
const [width, setWidth] = useState(window.innerWidth);
|
||||||
const [t] = useTranslation()
|
const [t] = useTranslation()
|
||||||
|
|
||||||
|
|
@ -127,9 +125,11 @@ const tabPosition = width > 1000 ? 'left' : 'top';
|
||||||
activeKey={activeKey}
|
activeKey={activeKey}
|
||||||
onEdit={(targetKey: any, action) => (action === 'add' ? handleAdd() : handleRemove(targetKey))}
|
onEdit={(targetKey: any, action) => (action === 'add' ? handleAdd() : handleRemove(targetKey))}
|
||||||
tabPosition={tabPosition}
|
tabPosition={tabPosition}
|
||||||
|
removeIcon={<MdOutlineDeleteOutline size={20}/>}
|
||||||
|
|
||||||
items={items.map((item: any) => ({
|
items={items.map((item: any) => ({
|
||||||
label: <Space>{t(`${item.label}`)} <CopyOutlined onClick={() => handleDuplicate(item.key)} /></Space>,
|
label: <Space>{t(`${item.label}`)} <CopyOutlined onClick={() => handleDuplicate(item.key)} /></Space>,
|
||||||
// children: item?.Add ? <AddAttributeTabs tabKey={item.key} /> : <AttributeTabs tabKey={item.key} />,
|
|
||||||
children: <AddAttributeTabs tabKey={item.key}/>,
|
children: <AddAttributeTabs tabKey={item.key}/>,
|
||||||
|
|
||||||
key: item.key,
|
key: item.key,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { toast } from 'react-toastify';
|
||||||
import { FormikValues, useFormikContext } from 'formik';
|
import { FormikValues, useFormikContext } from 'formik';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { AttributeValueTabs } from './AttributeTabs';
|
import { AttributeValueTabs } from './AttributeTabs';
|
||||||
|
import { MdOutlineDeleteOutline } from 'react-icons/md';
|
||||||
|
|
||||||
const { TabPane } = Tabs;
|
const { TabPane } = Tabs;
|
||||||
|
|
||||||
|
|
@ -105,6 +106,8 @@ const tabPosition ='top';
|
||||||
activeKey={activeKey}
|
activeKey={activeKey}
|
||||||
onEdit={(targetKey:any, action) => (action === 'add' ? handleAdd() : handleRemove(targetKey))}
|
onEdit={(targetKey:any, action) => (action === 'add' ? handleAdd() : handleRemove(targetKey))}
|
||||||
tabPosition={tabPosition}
|
tabPosition={tabPosition}
|
||||||
|
removeIcon={<MdOutlineDeleteOutline size={20}/>}
|
||||||
|
|
||||||
|
|
||||||
>
|
>
|
||||||
{items.map((item :any) =>{
|
{items.map((item :any) =>{
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
// TabsContainer.tsx
|
// TabsContainer.tsx
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Tabs, Space } from 'antd';
|
import { Tabs, Space } from 'antd';
|
||||||
import { CopyOutlined } from '@ant-design/icons';
|
import { CopyOutlined, DeleteFilled } from '@ant-design/icons';
|
||||||
import { FormikValues, useFormikContext } from 'formik';
|
import { FormikValues, useFormikContext } from 'formik';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { AttributeTabs as AddAttributeTabs} from '../../Add/AttributeTab/AttributeTabs';
|
import { AttributeTabs as AddAttributeTabs} from '../../Add/AttributeTab/AttributeTabs';
|
||||||
|
import { MdOutlineDeleteOutline } from 'react-icons/md';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -131,6 +132,7 @@ const tabPosition = width > 1000 ? 'left' : 'top';
|
||||||
activeKey={activeKey}
|
activeKey={activeKey}
|
||||||
onEdit={(targetKey: any, action) => (action === 'add' ? handleAdd() : handleRemove(targetKey))}
|
onEdit={(targetKey: any, action) => (action === 'add' ? handleAdd() : handleRemove(targetKey))}
|
||||||
tabPosition={tabPosition}
|
tabPosition={tabPosition}
|
||||||
|
removeIcon={<MdOutlineDeleteOutline size={20}/>}
|
||||||
items={items.map((item: any) => ({
|
items={items.map((item: any) => ({
|
||||||
label: <Space>{t(`${item.label}`)} <CopyOutlined onClick={() => handleDuplicate(item.key)} /></Space>,
|
label: <Space>{t(`${item.label}`)} <CopyOutlined onClick={() => handleDuplicate(item.key)} /></Space>,
|
||||||
// children: item?.Add ? <AddAttributeTabs tabKey={item.key} /> : <AttributeTabs tabKey={item.key} />,
|
// children: item?.Add ? <AddAttributeTabs tabKey={item.key} /> : <AttributeTabs tabKey={item.key} />,
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { useTranslation } from 'react-i18next';
|
||||||
import { AttributeValueTabs } from './AttributeTabs';
|
import { AttributeValueTabs } from './AttributeTabs';
|
||||||
|
|
||||||
import { AttributeValueTabs as AddAttributeValueTabs } from '../../Add/AttributeValueTab/AttributeTabs';
|
import { AttributeValueTabs as AddAttributeValueTabs } from '../../Add/AttributeValueTab/AttributeTabs';
|
||||||
|
import { MdOutlineDeleteOutline } from 'react-icons/md';
|
||||||
|
|
||||||
export const TabsContainer = ({ parentKey }: any) => {
|
export const TabsContainer = ({ parentKey }: any) => {
|
||||||
const [activeKey, setActiveKey] = useState('1');
|
const [activeKey, setActiveKey] = useState('1');
|
||||||
|
|
@ -123,6 +124,8 @@ const initialItemShape: any = {
|
||||||
activeKey={activeKey}
|
activeKey={activeKey}
|
||||||
onEdit={(targetKey: any, action) => (action === 'add' ? handleAdd() : handleRemove(targetKey))}
|
onEdit={(targetKey: any, action) => (action === 'add' ? handleAdd() : handleRemove(targetKey))}
|
||||||
tabPosition={tabPosition}
|
tabPosition={tabPosition}
|
||||||
|
removeIcon={<MdOutlineDeleteOutline size={20}/>}
|
||||||
|
|
||||||
items={
|
items={
|
||||||
items.map((item: any) => ({
|
items.map((item: any) => ({
|
||||||
label: <Space>{t(`${item.label}`)} <CopyOutlined onClick={() => handleDuplicate(item.key)} /></Space>,
|
label: <Space>{t(`${item.label}`)} <CopyOutlined onClick={() => handleDuplicate(item.key)} /></Space>,
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { useTranslation } from 'react-i18next';
|
||||||
import { useProductVarianState } from '../../../../lib/state mangment/Pages/Products';
|
import { useProductVarianState } from '../../../../lib/state mangment/Pages/Products';
|
||||||
import { VariableTabs } from './VariableTabs';
|
import { VariableTabs } from './VariableTabs';
|
||||||
import { log } from 'console';
|
import { log } from 'console';
|
||||||
|
import { MdOutlineDeleteOutline } from 'react-icons/md';
|
||||||
|
|
||||||
const { TabPane } = Tabs;
|
const { TabPane } = Tabs;
|
||||||
|
|
||||||
|
|
@ -137,6 +138,8 @@ export const TabsContainer: React.FC = () => {
|
||||||
activeKey={activeKey}
|
activeKey={activeKey}
|
||||||
onEdit={(targetKey: any, action) => (action === 'add' ? handleAdd() : handleRemove(targetKey))}
|
onEdit={(targetKey: any, action) => (action === 'add' ? handleAdd() : handleRemove(targetKey))}
|
||||||
tabPosition={tabPosition}
|
tabPosition={tabPosition}
|
||||||
|
removeIcon={<MdOutlineDeleteOutline size={20}/>}
|
||||||
|
|
||||||
items={
|
items={
|
||||||
items.map((item: any) => ({
|
items.map((item: any) => ({
|
||||||
label: <Space>{t(`${item.label}`)} <CopyOutlined onClick={() => handleDuplicate(item.key)} /></Space>,
|
label: <Space>{t(`${item.label}`)} <CopyOutlined onClick={() => handleDuplicate(item.key)} /></Space>,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user