| 66 | } |
| 67 | |
| 68 | onRenderHTML(rootElement: HTMLElement): void { |
| 69 | const { |
| 70 | className, |
| 71 | style, |
| 72 | icon, |
| 73 | label, |
| 74 | color, |
| 75 | onIcon = icon, |
| 76 | onLabel = label, |
| 77 | onColor = color |
| 78 | } = this.props; |
| 79 | const on = this.checked; |
| 80 | |
| 81 | rootElement.dataset.checked = String(on); |
| 82 | |
| 83 | render( |
| 84 | <IconButton |
| 85 | className={className} |
| 86 | style={style as JSX.CSSProperties} |
| 87 | icon={on ? onIcon : icon} |
| 88 | label={on ? onLabel : label} |
| 89 | color={on ? onColor : color} |
| 90 | onClick={this._toggle} |
| 91 | />, |
| 92 | rootElement |
| 93 | ); |
| 94 | } |
| 95 | |
| 96 | private _toggle = () => { |
| 97 | this.checked = !this.checked; |