Skip to content

Commit

Permalink
fix: solve #86
Browse files Browse the repository at this point in the history
  • Loading branch information
einazare committed May 11, 2021
1 parent 6c9e67f commit 6b37d25
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/components/NavPills/NavPills.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React from "react";
import classNames from "classnames";
// nodejs library to set properties for components
import PropTypes from "prop-types";
import SwipeableViews from "react-swipeable-views";

// @material-ui/core components
import { makeStyles } from "@material-ui/core/styles";
Expand All @@ -23,11 +22,8 @@ export default function NavPills(props) {
const handleChange = (event, active) => {
setActive(active);
};
const handleChangeIndex = (index) => {
setActive(index);
};
const classes = useStyles();
const { tabs, direction, color, horizontal, alignCenter } = props;
const { tabs, color, horizontal, alignCenter } = props;
const flexContainerClasses = classNames({
[classes.flexContainer]: true,
[classes.horizontalDisplay]: horizontal !== undefined,
Expand Down Expand Up @@ -71,19 +67,16 @@ export default function NavPills(props) {
);
const tabContent = (
<div className={classes.contentWrapper}>
<SwipeableViews
axis={direction === "rtl" ? "x-reverse" : "x"}
index={active}
onChangeIndex={handleChangeIndex}
>
{tabs.map((prop, key) => {
{tabs.map((prop, key) => {
if (key === active) {
return (
<div className={classes.tabContent} key={key}>
{prop.tabContent}
</div>
);
})}
</SwipeableViews>
}
return null;
})}
</div>
);
return horizontal !== undefined ? (
Expand Down Expand Up @@ -122,7 +115,6 @@ NavPills.propTypes = {
"info",
"rose",
]),
direction: PropTypes.string,
horizontal: PropTypes.shape({
tabsGrid: PropTypes.object,
contentGrid: PropTypes.object,
Expand Down

0 comments on commit 6b37d25

Please sign in to comment.