-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
183 additions
and
28 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
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
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,109 @@ | ||
--- | ||
title: 'Demo Components' | ||
slug: 'demos' | ||
contentType: 'TextContent' | ||
--- | ||
|
||
import HtmlDemo from '../HtmlDemo'; | ||
import MagicDemo from '../MagicDemo'; | ||
import JsDemo from '../JsDemo'; | ||
|
||
<HtmlDemo> | ||
|
||
```html | ||
<p>This tender treat is a perfect use for any old bananas you have sitting on the counter.</p> | ||
``` | ||
|
||
</HtmlDemo> | ||
|
||
<HtmlDemo> | ||
|
||
```html | ||
<h1>Easy Chocolate Chip Banana Bread</h1> | ||
<ul> | ||
<li>10 minutes prep time</li> | ||
<li>50 minutes bake time</li> | ||
<li>1 hr total</li> | ||
<li>Makes 6 servings</li> | ||
</ul> | ||
<img src="./banana-bread.jpeg" /> | ||
``` | ||
|
||
</HtmlDemo> | ||
|
||
<HtmlDemo> | ||
|
||
```html | ||
<ol> | ||
<li>Preheat oven to 350˚F (180˚C).</li> | ||
<li> | ||
In a bowl, add the bananas and mash until smooth. Add in the melted butter and stir until well | ||
combined. | ||
</li> | ||
<li> | ||
Add the sugar, egg, vanilla, baking soda, salt, and flour, and stir until the batter is smooth. | ||
</li> | ||
</ol> | ||
``` | ||
|
||
</HtmlDemo> | ||
|
||
<MagicDemo | ||
initialState={{title: 'Intro to Recycling', tagline: 'Learn about recycling'}} | ||
input={(state, updateState) => ( | ||
<> | ||
Title:{' '} | ||
<input value={state.title} onChange={e => updateState({...state, title: e.target.value})} /> | ||
Tagline: <input | ||
value={state.tagline} | ||
onChange={e => updateState({...state, tagline: e.target.value})} | ||
/> | ||
</> | ||
)} | ||
template={state => `<div> | ||
<h1>${state.title}</h1> | ||
<h2>${state.tagline}</h2> | ||
</div>`} | ||
/> | ||
|
||
<JsDemo defer> | ||
|
||
```js | ||
alert('Hi there!'); | ||
``` | ||
|
||
</JsDemo> | ||
|
||
<JsDemo> | ||
|
||
```js | ||
console.log('5 * 5 is ...'); | ||
console.log(5 * 5); | ||
``` | ||
|
||
</JsDemo> | ||
|
||
<JsDemo defer> | ||
|
||
```html | ||
<button>Click, and the monster will eat a list item</button> | ||
<ul> | ||
<li>A crunchy carrot</li> | ||
<li>A tasty tangerine</li> | ||
<li>A sweet strawberry</li> | ||
<li>A perfect peach</li> | ||
</ul> | ||
``` | ||
|
||
```js | ||
let button = document.querySelector('button'); | ||
let indexToEat = 0; | ||
button.addEventListener('click', function () { | ||
let items = document.querySelectorAll('li'); | ||
let snack = items[indexToEat]; | ||
snack.innerText = 'The monster ate it!'; | ||
indexToEat = indexToEat + 1; | ||
}); | ||
``` | ||
|
||
</JsDemo> |
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
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
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
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,6 @@ | ||
.code pre, | ||
.code div { | ||
height: 100%; | ||
margin-top: 0 !important; | ||
margin-bottom: 0 !important; | ||
} |