import * as React from 'react' import { observer } from 'mobx-react' import { Line, Circle } from 'rc-progress' import 'rc-progress/assets/index.css' import './progress.css' interface IProps { type: 'line' | 'circle' percent: number showLabel?: boolean gapDegree?: number gapPosition?: string strokeWidth?: number strokeColor?: string trailWidth?: number trailColor?: string strokeLinecap?: string className?: string style?: object } @observer class Progress extends React.Component { mq: MediaQueryList constructor(props: IProps) { super(props) this.mq = window.matchMedia('(max-width: 767px)') } render() { const { type, showLabel, percent, ...rest } = this.props const svgProps = Object.assign({}, this.props) if (type === 'line') { let isMobile = this.mq.matches let strokeWith = isMobile ? 6 : 4 return ( ) } else if (type === 'circle' && showLabel) { return (
{percent}%
) } else if (type === 'circle') { return ( ) } else { return null } } } export default Progress