fix key, add proptypes
This commit is contained in:
1 parent
a230068e37
commit
9e1dc92dbf
1 file changed
+29
-8
@@ -1,7 +1,11 @@
|
|||||||
|
// Components
|
||||||
import { TabContext, TabList } from "@mui/lab";
|
import { TabContext, TabList } from "@mui/lab";
|
||||||
import { Stack, Tab } from "@mui/material";
|
import { Tab } from "@mui/material";
|
||||||
import Settings from "./Settings";
|
import Settings from "./Settings";
|
||||||
import Content from "./Content";
|
import Content from "./Content";
|
||||||
|
|
||||||
|
// Utils
|
||||||
|
import PropTypes from "prop-types";
|
||||||
const Tabs = ({
|
const Tabs = ({
|
||||||
form,
|
form,
|
||||||
errors,
|
errors,
|
||||||
@@ -23,13 +27,15 @@ const Tabs = ({
|
|||||||
setTab(TAB_LIST.indexOf(tab));
|
setTab(TAB_LIST.indexOf(tab));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{TAB_LIST.map((tab, idx) => (
|
{TAB_LIST.map((tab, idx) => {
|
||||||
<Tab
|
return (
|
||||||
key={Math.random()}
|
<Tab
|
||||||
label={TAB_LIST[idx]}
|
key={tab}
|
||||||
value={TAB_LIST[idx]}
|
label={TAB_LIST[idx]}
|
||||||
/>
|
value={TAB_LIST[idx]}
|
||||||
))}
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</TabList>
|
</TabList>
|
||||||
{tab === 0 ? (
|
{tab === 0 ? (
|
||||||
<Settings
|
<Settings
|
||||||
@@ -56,4 +62,19 @@ const Tabs = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Tabs.propTypes = {
|
||||||
|
form: PropTypes.object,
|
||||||
|
errors: PropTypes.object,
|
||||||
|
monitors: PropTypes.array,
|
||||||
|
selectedMonitors: PropTypes.array,
|
||||||
|
setSelectedMonitors: PropTypes.func,
|
||||||
|
handleFormChange: PropTypes.func,
|
||||||
|
handleImageChange: PropTypes.func,
|
||||||
|
progress: PropTypes.number,
|
||||||
|
removeLogo: PropTypes.func,
|
||||||
|
tab: PropTypes.number,
|
||||||
|
setTab: PropTypes.func,
|
||||||
|
TAB_LIST: PropTypes.array,
|
||||||
|
};
|
||||||
|
|
||||||
export default Tabs;
|
export default Tabs;
|
||||||
Reference in new issue
Block a user