import { ComponentClass } from 'react'
import Taro, { Component } from '@tarojs/taro'
import { View, Image, Label } from '@tarojs/components'
import './index.scss'

type PageOwnProps = {
  className?: string
  title: any
  image?: any
  extra?: any
}


type IProps = PageOwnProps

interface Index {
  props: IProps;
}

class Index extends Component {
  static options = {
    addGlobalClass: true
  }
  render() {
    const { title, image, extra } = this.props
    return (
      <View className={'sd-article-title ' + (this.props.className || '')}>
        {
          image &&
          <Image className='sd-article-title-icon' src={image} />
        }
        <Label>{title}</Label>
        <Label className='sd-article-title-extra'>{extra || ''}</Label>
      </View>
    )
  }
}

export default Index as ComponentClass<PageOwnProps>