forked from arwes/arwes
-
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.
chore(playground): playground application
- Loading branch information
1 parent
99e0bcd
commit ca10818
Showing
50 changed files
with
685 additions
and
320 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 |
---|---|---|
|
@@ -44,4 +44,4 @@ yarn-error.log* | |
.yarn-integrity | ||
|
||
packages/*/lib | ||
playground/public | ||
playground/dist |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,35 @@ | ||
```js | ||
const PlayerComponent = ({ players, audio, name }) => ( | ||
<button onClick={() => !audio.mute && players[name].play()}> | ||
Play {name} | ||
</button> | ||
); | ||
|
||
const Player = withSounds()(PlayerComponent); | ||
|
||
const players = { | ||
information: new Howl({ src: ['/sounds/information.mp3'] }), | ||
ask: new Howl({ src: ['/sounds/ask.mp3'] }), | ||
warning: new Howl({ src: ['/sounds/warning.mp3'] }), | ||
error: new Howl({ src: ['/sounds/error.mp3'] }) | ||
}; | ||
|
||
function Sandbox () { | ||
const [mute, setMute] = React.useState(false); | ||
|
||
return ( | ||
<SoundsProvider players={players} audio={{ mute }}> | ||
<button onClick={() => setMute(!mute)}> | ||
{mute ? 'Unmute' : 'Mute'} | ||
</button> | ||
<br /> | ||
<Player name='information' /> | ||
<Player name='ask' /> | ||
<Player name='warning' /> | ||
<Player name='error' /> | ||
</SoundsProvider> | ||
); | ||
} | ||
|
||
render(<Sandbox />); | ||
``` |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.