/
githubmirror
/
wp-calypso
Обзор
Документация
Войти
/
githubmirror
/
wp-calypso
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/components/src/progress-bar/docs/example.jsx
31 строка
830 B
Marko Andrijasevic
React: add new JSX transform (#56451)
29 сен 2021, 13:49
Не верифицирован
29 сен 2021, 13:49
f2e6f88
Код
Авторство
О чём код?
import { PureComponent } from 'react'; import ProgressBar from '..'; export default class extends PureComponent { static displayName = 'ProgressBar'; state = { compact: false, }; toggleCompact = () => { this.setState( { compact: ! this.state.compact } ); }; render() { const toggleText = this.state.compact ? 'Normal Bar' : 'Compact Bar'; return ( <div> <button className="docs__design-toggle button" onClick={ this.toggleCompact }> { toggleText } </button> <ProgressBar value={ 0 } title="0% complete" compact={ this.state.compact } /> <ProgressBar value={ 55 } total={ 100 } compact={ this.state.compact } /> <ProgressBar value={ 100 } color="#1BABDA" compact={ this.state.compact } /> <ProgressBar value={ 75 } compact={ this.state.compact } isPulsing /> </div> ); } }