forked from marcysutton/gatsby-a11y-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add taco button class component example
- Loading branch information
Marcy Sutton
committed
Feb 2, 2020
1 parent
92a3dd1
commit 9720a85
Showing
2 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, {Component} from 'react' | ||
|
||
class TacoComponent extends Component { | ||
constructor(props) { | ||
super() | ||
this.tacoTopping = props.topping || '' | ||
} | ||
getTacos() { | ||
if (window) { | ||
window.alert(`TACOS! 🌮${this.tacoTopping}`) | ||
} | ||
} | ||
// lifecycle methods here | ||
render () { | ||
return ( | ||
<div style={{padding: '1em'}}> | ||
<button | ||
onClick={() => { this.getTacos()}} | ||
style={{fontSize: '1.5em'}}> | ||
Get tacos | ||
</button> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default TacoComponent |
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