-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from alampros/develop
Cleanup on mount and update deps
- Loading branch information
Showing
8 changed files
with
604 additions
and
567 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,15 @@ | ||
import React from 'react' | ||
import useWindowSize from 'react-use/lib/useWindowSize' | ||
|
||
import ReactConfetti from '../src/ReactConfetti' | ||
|
||
export default (passedProps) => { | ||
const { width, height } = useWindowSize() | ||
return ( | ||
<ReactConfetti | ||
width={width} | ||
height={height} | ||
{...passedProps} | ||
/> | ||
) | ||
} |
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,31 @@ | ||
import React, { useState } from 'react' | ||
import { storiesOf } from '@storybook/react' | ||
|
||
import ReactConfetti from '../src/ReactConfetti' | ||
|
||
const Toggler = ({ children }) => { | ||
const [isVisible, setVisible] = useState(true) | ||
const handleClick = () => { | ||
setVisible(!isVisible) | ||
} | ||
return ( | ||
<div> | ||
{isVisible && children} | ||
<div style={{ position: 'absolute', top: 10, left: 10 }}> | ||
<button onClick={handleClick}> | ||
Toggle | ||
</button> | ||
<aside style={{ marginTop: '2rem' }}> | ||
This is just to test that the confetti is cleaned up properly when the component is unmounted. | ||
</aside> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
storiesOf('Tests', module) | ||
.add('Cleanup on mount', () => ( | ||
<Toggler> | ||
<ReactConfetti style={{ zIndex: 0 }} /> | ||
</Toggler> | ||
)) |
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
Oops, something went wrong.