Update website.

pull/23/head
jaywcjlove 7 years ago
parent 8c964c8434
commit db65ab65ef

@ -70,11 +70,8 @@ export default class App extends Component {
<div className={styles.header}>
<div className={styles.title}>HotKeys.js</div>
<div className={styles.github}>
<a href="https://github.com/jaywcjlove/hotkeys/zipball/master">
<button>Download as zip</button>
</a>
<a href="https://github.com/jaywcjlove/hotkeys/tarball/master">
<button>Download as tar.gz</button>
<a href="https://www.npmjs.com/package/hotkeys-js">
<button>On NPM</button>
</a>
<a href="https://github.com/jaywcjlove/hotkeys/">
<button>Fork on Github</button>
@ -92,14 +89,14 @@ export default class App extends Component {
/>
<Markdown source={DocumentStr} />
<GithubShields source={[
{
href: 'https://github.com/jaywcjlove/hotkeys/network',
img: 'https://img.shields.io/github/forks/jaywcjlove/hotkeys.svg?style=social'
},
{
href: 'https://github.com/jaywcjlove/hotkeys/stargazers',
img: 'https://img.shields.io/github/stars/jaywcjlove/hotkeys.svg?style=social'
},
{
href: 'https://github.com/jaywcjlove/hotkeys/network',
img: 'https://img.shields.io/github/forks/jaywcjlove/hotkeys.svg?style=social'
},
{
href: 'https://github.com/jaywcjlove/hotkeys/watchers',
img: 'https://img.shields.io/github/watchers/jaywcjlove/hotkeys.svg?style=social&label=Watch'
@ -109,7 +106,7 @@ export default class App extends Component {
img: 'https://img.shields.io/github/followers/jaywcjlove.svg?style=social'
},
]} />
<Footer name="Kenny Wong" href="http://jaywcjlove.github.io" year="2015" />
<Footer name="Kenny Wong" href="http://jaywcjlove.github.io" year="2015-present" />
</div>
)
}

@ -3,6 +3,11 @@ import style from './Footer.less';
export default function Footer({ name, href, year}) {
return (
<div className={style.footer}>© <a target="_blank" href={href}>{name}</a> {year}</div>
<div className={style.footer}>
<div>Licensed under MIT. (Yes it's free and <a href="https://github.com/jaywcjlove/hotkeys">open-sourced</a>)</div>
<div>
© <a target="_blank" href={href}>{name}</a> {year}
</div>
</div>
)
}

@ -2,4 +2,5 @@
text-align: center;
padding: 15px 0 100px 0;
font-size: 12px;
line-height: 20px;
}

@ -31,6 +31,7 @@
border-radius: 8px;
border: 1px solid #3A3A3A;
box-shadow: 1px 0px 0px rgb(0,0,0),0px 1px 0px rgb(0,0,0),-1px 0px 0px rgb(0,0,0),0px -1px 0px rgb(0,0,0);
transition: all .2s;
user-select: none;
cursor: pointer;
position: relative;

@ -31,6 +31,9 @@ pre {
background-color: #F0F0F0;
border-radius: 3px;
}
del {
color: #888;
}
pre code {
background: none;
font-size: 1em;
@ -57,7 +60,10 @@ a {
color: #0366d6;
}
p {
margin-bottom: 10px;
margin-bottom: 16px;
}
table {
margin-bottom: 16px;
}
blockquote {
margin: 0;

@ -1,7 +1,17 @@
HotKeys.js is an input capture library with some very special features, it is easy to pick up and use, has a reasonable footprint (~3kb), and has no dependencies. It should not interfere with any JavaScript libraries or frameworks.
HotKeys.js is an input capture library with some very special features, it is easy to pick up and use, has a reasonable footprint (~3kb) (gzipped: 1.73kb), and has no dependencies. It should not interfere with any JavaScript libraries or frameworks.
## USAGE
[![](https://img.shields.io/github/issues/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/issues) [![](https://img.shields.io/github/forks/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/network) [![](https://img.shields.io/github/stars/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/stargazers) [![](https://img.shields.io/github/release/jaywcjlove/hotkeys.svg)](https://github.com/jaywcjlove/hotkeys/releases) ![](http://jaywcjlove.github.io/sb/status/no-dependencies.svg)
```bash
__ __ __
| |--..-----.| |_ | |--..-----..--.--..-----.
| || _ || _|| < | -__|| | ||__ --|
|__|__||_____||____||__|__||_____||___ ||_____|
|_____|
```
## Usage
You will need `Node.js` installed on your system.
@ -9,13 +19,13 @@ You will need `Node.js` installed on your system.
$ npm install hotkeys-js --save
```
```
```js
import hotkeys from 'hotkeys-js';
```
Or manually download and link **hotkeys.js** in your HTML:
```js
```html
<script type="text/javascript" src="hotkeys.js"></script>
```
@ -29,6 +39,37 @@ $ npm install react-hot-keys --save
Detailed use method please see its documentation [react-hotkeys](https://github.com/jaywcjlove/react-hotkeys).
```jsx
import React, { Component } from 'react';
import Hotkeys from 'react-hot-keys';
export default class HotkeysDemo extends Component {
constructor(props) {
super(props);
this.state = {
output: 'Hello, I am a component that listens to keydown and keyup of a',
}
}
onKeyUp(keyNm, e, handle) {
this.setState({output: keyNm})
}
onKeyDown(keyName, e, handle) {
this.setState({output: keyNm})
}
render() {
return (
<Hotkeys
keyName="shift+a,alt+s"
onKeyDown={this.onKeyDown.bind(this)}
onKeyUp={this.onKeyUp.bind(this)}
>
<div style={{ padding: 50 }}> {this.state.output} </div>
</Hotkeys>
)
}
}
```
## Browser Support
Mousetrap has been tested and should work in.
@ -40,7 +81,7 @@ Firefox
Chrome
```
## DEFINING SHORTCUTS
## Defining Shortcuts
One global method is exposed, key which defines shortcuts when called directly.
@ -197,7 +238,7 @@ hotkeys()
// @ VM2165:816InjectedScript.evaluate @ VM2165:682
```
### SUPPORTED KEYS
## Supported Keys
HotKeys understands the following modifiers: `⇧`, `shift`, `option`, `⌥`, `alt`, `ctrl`, `control`, `command`, and `⌘`.
@ -233,14 +274,13 @@ Run Document Website Environment.
$ npm run doc:dev
```
To contribute, please fork Hotkeys.js, add your patch and tests for it (in the `test/` folder) and submit a pull request.
```shell
$ npm run test
$ npm run test:watch # Development model
```
## License
[MIT © Kenny Wong](https://kossnocorp.mit-license.org/)
```bash
__ __ __
| |--..-----.| |_ | |--..-----..--.--..-----.
| || _ || _|| < | -__|| | ||__ --|
|__|__||_____||____||__|__||_____||___ ||_____|
|_____|
```
Loading…
Cancel
Save