import { createElement, Fragment, Component } from '@wordpress/element' import OptionsPanel from '../OptionsPanel' import classnames from 'classnames' import { normalizeCondition, matchValuesWithCondition } from 'match-conditions' export default class Tabs extends Component { state = { currentTab: 0 } render() { const filteredTabs = this.props.renderingChunk.filter( singleTab => !singleTab.condition || matchValuesWithCondition( normalizeCondition(singleTab.condition), this.props.value ) ) const currentTab = filteredTabs[this.state.currentTab] return (
this.props.onChange(key, val)} options={currentTab.options} value={this.props.value} />
) } } /* const Condition = ({ renderingChunk, value, onChange }) => renderingChunk.map( conditionOption => matchValuesWithCondition( normalizeCondition(conditionOption.condition), value ) ? ( onChange({ ...value, ...val })} options={conditionOption.options} value={value} /> ) : ( [] ) ) export default Condition */