|
- {"ast":null,"code":"var __jsx = React.createElement;\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nimport React from \"react\"; // nodejs library that concatenates classes\n\nimport classNames from \"classnames\"; // nodejs library to set properties for components\n\nimport SwipeableViews from \"react-swipeable-views\"; // @material-ui/core components\n\nimport { makeStyles } from \"@material-ui/core/styles\";\nimport Tabs from \"@material-ui/core/Tabs\";\nimport Tab from \"@material-ui/core/Tab\"; // core components\n\nimport GridContainer from \"components/Grid/GridContainer.js\";\nimport GridItem from \"components/Grid/GridItem.js\";\nimport styles from \"assets/jss/nextjs-material-kit/components/navPillsStyle.js\";\nconst useStyles = makeStyles(styles);\nexport default function NavPills(props) {\n const [active, setActive] = React.useState(props.active);\n\n const handleChange = (event, active) => {\n setActive(active);\n };\n\n const handleChangeIndex = index => {\n setActive(index);\n };\n\n const classes = useStyles();\n const {\n tabs,\n direction,\n color,\n horizontal,\n alignCenter\n } = props;\n const flexContainerClasses = classNames({\n [classes.flexContainer]: true,\n [classes.horizontalDisplay]: horizontal !== undefined\n });\n\n const tabButtons = __jsx(Tabs, {\n classes: {\n root: classes.root,\n fixed: classes.fixed,\n flexContainer: flexContainerClasses,\n indicator: classes.displayNone\n },\n value: active,\n onChange: handleChange,\n centered: alignCenter\n }, tabs.map((prop, key) => {\n var icon = {};\n\n if (prop.tabIcon !== undefined) {\n icon[\"icon\"] = __jsx(prop.tabIcon, {\n className: classes.tabIcon\n });\n }\n\n const pillsClasses = classNames({\n [classes.pills]: true,\n [classes.horizontalPills]: horizontal !== undefined,\n [classes.pillsWithIcons]: prop.tabIcon !== undefined\n });\n return __jsx(Tab, _extends({\n label: prop.tabButton,\n key: key\n }, icon, {\n classes: {\n root: pillsClasses,\n selected: classes[color],\n wrapper: classes.tabWrapper\n }\n }));\n }));\n\n const tabContent = __jsx(\"div\", {\n className: classes.contentWrapper\n }, __jsx(SwipeableViews, {\n axis: direction === \"rtl\" ? \"x-reverse\" : \"x\",\n index: active,\n onChangeIndex: handleChangeIndex\n }, tabs.map((prop, key) => {\n return __jsx(\"div\", {\n className: classes.tabContent,\n key: key\n }, prop.tabContent);\n })));\n\n return horizontal !== undefined ? __jsx(GridContainer, null, __jsx(GridItem, horizontal.tabsGrid, tabButtons), __jsx(GridItem, horizontal.contentGrid, tabContent)) : __jsx(\"div\", null, tabButtons, tabContent);\n}\nNavPills.defaultProps = {\n active: 0,\n color: \"primary\"\n};","map":null,"metadata":{},"sourceType":"module"}
|