App.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import * as React from 'react';
  2. import GitHubCorners from './GitHubCorners';
  3. import RuleTable from './RuleTable';
  4. interface AppState {
  5. onlyShowOff: boolean;
  6. }
  7. export default class App extends React.Component<{}, AppState> {
  8. public state = {
  9. onlyShowOff: false
  10. };
  11. public render() {
  12. return (
  13. <div>
  14. <GitHubCorners href="https://github.com/AlloyTeam/tslint-config-alloy" />
  15. {this.renderHeader()}
  16. <RuleTable onlyShowOff={this.state.onlyShowOff} />
  17. </div>
  18. );
  19. }
  20. private handleOnlyShowOffChange(e) {
  21. this.setState({
  22. onlyShowOff: e.target.checked
  23. });
  24. }
  25. private renderHeader() {
  26. return (
  27. <div className="flex-center">
  28. <div className="container-fluid">
  29. <h1>AlloyTeam TSLint 规则</h1>
  30. <form className="top-gap site-form">
  31. <label>
  32. <input
  33. type="checkbox"
  34. checked={this.state.onlyShowOff}
  35. onChange={this.handleOnlyShowOffChange.bind(this)}
  36. />
  37. 隐藏已禁用的规则
  38. </label>
  39. </form>
  40. </div>
  41. </div>
  42. );
  43. }
  44. }