-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(HotKeyWrapper): Add new lifeCycle (componentWillReceiveProps)
Also add the demo page taking in consideration the change due to the HMR
- Loading branch information
1 parent
4a72a54
commit d91c106
Showing
22 changed files
with
958 additions
and
140 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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
language: node_js | ||
|
||
cache: | ||
directories: | ||
- node_modules | ||
|
||
notifications: | ||
email: false | ||
|
||
|
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,23 @@ | ||
import HotkeyWrapper from '../../src'; | ||
import React, { Component } from 'react'; | ||
import { | ||
WhyYouShouldUseIt, | ||
BuiltWith, | ||
Installation, | ||
InAction, | ||
Props, | ||
License, | ||
} from './sections'; | ||
|
||
const Container = () => ( | ||
<div className="container"> | ||
<WhyYouShouldUseIt /> | ||
<BuiltWith /> | ||
<Installation /> | ||
<InAction /> | ||
<Props /> | ||
<License /> | ||
</div> | ||
); | ||
|
||
export default Container; |
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 |
---|---|---|
@@ -1,33 +1,107 @@ | ||
:root { | ||
--white: #e0fbfc; | ||
--gunMetal: #293241; | ||
--lightRed: #ee6c4d; | ||
--purpleNavy: #3d5a80; | ||
--paleCerulean: #98c1d9; | ||
} | ||
|
||
body { | ||
background: linear-gradient(90deg, #63008c, #a700da 70%); | ||
margin: 0; | ||
padding: 0; | ||
font-family: sans-serif; | ||
font-family: 'Nunito', sans-serif; | ||
} | ||
|
||
.main-container { | ||
margin: auto; | ||
max-width: 800px; | ||
#demo { | ||
background: linear-gradient( | ||
to top right, | ||
var(--purpleNavy), | ||
var(--paleCerulean) | ||
); | ||
|
||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
min-height: 100vh; | ||
flex-direction: column; | ||
} | ||
|
||
header { | ||
color: var(--white); | ||
text-align: center; | ||
} | ||
|
||
h1 { | ||
color: white; | ||
header > h1 { | ||
font-size: 40px; | ||
} | ||
|
||
.container { | ||
border-radius: 25px; | ||
background: #ffffff; | ||
header > h2 { | ||
font-size: 25px; | ||
} | ||
|
||
.home { | ||
.container { | ||
border-radius: 25px; | ||
background: var(--white); | ||
color: var(--gunMetal); | ||
display: flex; | ||
justify-content: center; | ||
flex-direction: column; | ||
align-items: center; | ||
margin: 0 30px; | ||
width: 600px; | ||
padding: 1.5rem 2rem; | ||
flex: 1; | ||
box-shadow: 0 0 80px -4px rgba(0, 20, 40, 0.1); | ||
} | ||
|
||
.container > section { | ||
width: 100%; | ||
} | ||
|
||
.container > section > table { | ||
font-size: 14px; | ||
border-collapse: collapse; | ||
line-height: 30px; | ||
text-align: left; | ||
} | ||
|
||
.container > section > table > tr > tr { | ||
padding: 5px; | ||
} | ||
|
||
.container > section > table > tr > td { | ||
padding: 5px; | ||
} | ||
|
||
.container > section > h2 { | ||
font-size: 20px; | ||
text-align: left; | ||
} | ||
|
||
.container > section > pre { | ||
padding: 10px; | ||
overflow: auto; | ||
overflow-y: hidden; | ||
border-radius: 10px; | ||
line-height: 20px; | ||
box-shadow: 0 0 20px 7px rgba(63, 63, 63, 0.4); | ||
} | ||
|
||
.container > section > pre code { | ||
padding: 10px; | ||
} | ||
|
||
footer { | ||
text-align: end; | ||
width: 100%; | ||
margin-right: 20px; | ||
} | ||
|
||
.home > * { | ||
margin: 10px; | ||
@media (max-width: 600px) { | ||
.container { | ||
width: 100%; | ||
border-radius: 0px; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
} |
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,14 @@ | ||
import React from 'react'; | ||
|
||
const Footer = () => { | ||
return ( | ||
<footer> | ||
<p> | ||
Result of <a href="http://www.100daysofcode.com/">#100DaysOfCode</a> - | ||
Develop with ❤️ | ||
</p> | ||
</footer> | ||
); | ||
}; | ||
|
||
export default Footer; |
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,14 @@ | ||
import React from 'react'; | ||
import GithubCorner from 'react-github-corner'; | ||
|
||
const GithubLink = () => ( | ||
<GithubCorner | ||
href="https://github.com/EmaSuriano/weather-styled-icon" | ||
octoColor="#EE6C4D" | ||
bannerColor="#e0fbfc" | ||
size={80} | ||
direction="right" | ||
/> | ||
); | ||
|
||
export default GithubLink; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import HotkeyWrapper from 'lib'; | ||
|
||
const Title = () => { | ||
return ( | ||
<header> | ||
<HotkeyWrapper | ||
hotkey="r+h+t" | ||
onHotkeyPressed={() => | ||
window.open('https://www.youtube.com/watch?v=dQw4w9WgXcQ') | ||
} | ||
tooltipHotkey="h" | ||
tooltipProps={{ | ||
theme: 'light', | ||
size: 'big', | ||
arrow: true, | ||
}} | ||
> | ||
<h1 ref={c => (this.title = c)} tabIndex="0"> | ||
React Hotkey Tooltip | ||
</h1> | ||
</HotkeyWrapper> | ||
<h2>A global Hotkey provider with built in tooltip for React</h2> | ||
</header> | ||
); | ||
}; | ||
|
||
export default Title; |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
import React, { Component } from 'react'; | ||
import { render } from 'react-dom'; | ||
import ReactDOM from 'react-dom'; | ||
import Demo from './Demo'; | ||
import WebFont from 'webfontloader'; | ||
|
||
render(<Demo />, document.querySelector('#demo')); | ||
WebFont.load({ | ||
google: { | ||
families: ['Nunito:300,400,700', 'sans-serif'], | ||
}, | ||
}); | ||
|
||
ReactDOM.render(<Demo />, document.querySelector('#demo')); |
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,51 @@ | ||
import React from 'react'; | ||
import HotkeyWrapper from 'lib'; | ||
|
||
const BuiltWith = () => ( | ||
<section> | ||
<h2>Built with</h2> | ||
<p> | ||
Why mess up with document.addEventListener or positioning/styling tooltips | ||
if there are a lot of open source libraries that can do that for me. This | ||
are the chosen ones! | ||
</p> | ||
<ul> | ||
<li> | ||
<HotkeyWrapper | ||
hotkey="m+t" | ||
onHotkeyPressed={() => this.mousetrapLink.click()} | ||
tooltipProps={{ | ||
arrow: true, | ||
position: 'top', | ||
}} | ||
tooltipHotkey="h" | ||
> | ||
<a | ||
href="https://github.com/ccampbell/mousetrap" | ||
ref={a => (this.mousetrapLink = a)} | ||
target="_blank" | ||
> | ||
mousetrap | ||
</a> | ||
</HotkeyWrapper>: to bind and unbind hotkeys globally 🌐 | ||
</li> | ||
<li> | ||
<HotkeyWrapper | ||
hotkey="r+t" | ||
onHotkeyPressed={() => this.reactTippyLink.click()} | ||
tooltipHotkey="h" | ||
> | ||
<a | ||
href="https://github.com/tvkhoa/react-tippy" | ||
ref={a => (this.reactTippyLink = a)} | ||
target="_blank" | ||
> | ||
react-tippy | ||
</a> | ||
</HotkeyWrapper>: to display beautiful tooltips 😄 | ||
</li> | ||
</ul> | ||
</section> | ||
); | ||
|
||
export default BuiltWith; |
Oops, something went wrong.