UNPKG

@zohodesk/components

Version:

In this Package, we Provide Some Basic Components to Build Web App

63 lines (60 loc) 1.91 kB
import React from 'react'; import { AccordionItem_defaultProps } from "./props/defaultProps"; import { AccordionItem_propTypes } from "./props/propTypes"; import VelocityAnimation from "../VelocityAnimation/VelocityAnimation/VelocityAnimation"; import VelocityAnimationGroup from "../VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup"; export default class AccordionItem extends React.Component { constructor(props) { super(props); this.equalityCheck = this.equalityCheck.bind(this); } equalityCheck() { let { equalityCheck, selectedItem, id } = this.props; return equalityCheck ? equalityCheck(id, selectedItem) : selectedItem == id; } render() { let { id, selectMenu, className, children, dataId, dataSelectorId, unMount, unMountItem, a11y, innerClass } = this.props; unMountItem = unMountItem !== undefined ? unMountItem : unMount; let { role } = a11y; return /*#__PURE__*/React.createElement("div", { className: className ? className : '', "data-id": dataId, "data-test-id": dataId, role: role, "data-selector-id": dataSelectorId }, /*#__PURE__*/React.createElement("div", { className: innerClass ? innerClass : '', onClick: selectMenu.bind(this, id) }, children[0]), unMountItem ? /*#__PURE__*/React.createElement(VelocityAnimationGroup, { name: "slideDown", isActive: this.equalityCheck() }, children[1]) : /*#__PURE__*/React.createElement(VelocityAnimation, { name: "slideDown", isActive: this.equalityCheck() }, children[1])); } } AccordionItem.propTypes = AccordionItem_propTypes; AccordionItem.defaultProps = AccordionItem_defaultProps; // if (__DOCS__) { // AccordionItem.docs = { // componentGroup: 'Animation', // folderName: 'Style Guide' // }; // }