import { View } from '@tarojs/components';
import { Component, ReactNode } from 'react';
import { AtAccordion } from 'taro-ui';

export class ExpandItem extends Component {
  state = {
    open: false,
  };
  props = {
    title: '',
    content: <View></View>,
  };

  handleClick(value: boolean) {
    this.setState({ open: value });
  }

  render(): ReactNode {
    return (
      <View>
        <AtAccordion
          open={this.state.open}
          onClick={this.handleClick.bind(this)}
          title={this.props.title}
        >
          {this.props.content}
        </AtAccordion>
      </View>
    );
  }
}
