File "index.js"

Full Path: /home/siazco/grocery.siazco.se/wp-content/plugins/better-wp-security/core/packages/components/src/tab-panel/index.js
File size: 684 bytes
MIME-type: text/x-java
Charset: utf-8

/**
 * WordPress dependencies
 */
import { Component } from '@wordpress/element';

/**
 * Internal dependencies
 */
import ControlledTabPanel from './controlled';
import ControlledMultiTabPanel from './multi';
import './style.scss';

export { ControlledTabPanel, ControlledMultiTabPanel };

export default class UncontrolledTabPanel extends Component {
	constructor() {
		super( ...arguments );

		this.state = {
			selected: this.props.initialTab || '',
		};
	}

	onSelect = ( selected ) => {
		this.setState( { selected } );
	};

	render() {
		return (
			<ControlledTabPanel
				{ ...this.props }
				selected={ this.state.selected }
				onSelect={ this.onSelect }
			/>
		);
	}
}