Last active
November 9, 2017 06:59
-
-
Save yuschick/64c52db5f6e3025783ec1fd37caf8504 to your computer and use it in GitHub Desktop.
Accessible Web Apps with React, TypeScript & Ally.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface AppState { | |
showDialog: boolean; | |
} | |
class App extends React.Component<{}, AppState> { | |
state: AppState; | |
constructor(props: {}) { | |
super(props); | |
this.state = { | |
showDialog: false | |
}; | |
} | |
toggleDialog() { | |
this.setState({ showDialog: !this.state.showDialog }); | |
} | |
render() { | |
return ( | |
<div className="site-container"> | |
<header> | |
<h1>Ally.js with React & Typescript</h1> | |
</header> | |
<main className="content-container"> | |
<div className="field-container"> | |
<label htmlFor="name-field">Name:</label> | |
<input type="text" id="name-field" placeholder="Enter your name" /> | |
</div> | |
<div className="field-container"> | |
<label htmlFor="food-field">Favourite Food:</label> | |
<input type="text" id="food-field" placeholder="Enter your favourite food" /> | |
</div> | |
<div className="field-container"> | |
<button | |
className='btn primary' | |
tabIndex={0} | |
title='Open Dialog' | |
onClick={() => this.toggleDialog()} | |
> | |
Open Dialog | |
</button> | |
</div> | |
</main> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment