-
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.
- Loading branch information
0 parents
commit 8433c65
Showing
26 changed files
with
8,297 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"presets": [ | ||
"es2015", | ||
"react" | ||
], | ||
"plugins": [ | ||
"syntax-dynamic-import" | ||
] | ||
} |
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,5 @@ | ||
{ | ||
"ignore": [ | ||
"dist/*.js" | ||
] | ||
} |
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,21 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
|
||
# Change these settings to your own preference | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# We recommend you to keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = 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,26 @@ | ||
module.exports = { | ||
"extends": "airbnb", | ||
"parser": "babel-eslint", | ||
"env": { | ||
"browser": true, | ||
"jasmine": true, | ||
"node": true | ||
}, | ||
"plugins": [ | ||
"react" | ||
], | ||
"rules": { | ||
"comma-dangle": ["error", "never"], | ||
"global-require": 0, | ||
"prefer-arrow-callback": 0, | ||
"func-names": 0, | ||
"import/no-extraneous-dependencies": 0, | ||
"no-underscore-dangle": 0, | ||
"no-unused-expressions": 0, | ||
"no-use-before-define": 0, | ||
"react/jsx-filename-extension": 0, | ||
"react/sort-comp": 0, | ||
"react/no-multi-comp": 0, | ||
"react/require-extension": 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* text=auto | ||
bin/* eol=lf |
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,9 @@ | ||
docs/build/ | ||
dist-es6/ | ||
dist-modules/ | ||
node_modules/ | ||
coverage/ | ||
/.idea/ | ||
npm-debug.log | ||
.eslintcache | ||
style.min.css |
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 @@ | ||
demo/ | ||
dist/ | ||
tests/ | ||
src/ | ||
.* | ||
|
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,10 @@ | ||
language: node_js | ||
node_js: | ||
- "6" | ||
- "7" | ||
- "8" | ||
script: | ||
- npm run test:lint | ||
- npm run test:coverage | ||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) |
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,20 @@ | ||
Copyright (c) 2016 Stéphane Monnot | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,93 @@ | ||
[![build status](https://secure.travis-ci.org/stephane-monnot/react-fake-code-typing.svg)](http://travis-ci.org/stephane-monnot/react-fake-code-typing) [![bitHound Score](https://www.bithound.io/github/stephane-monnot/react-fake-code-typing/badges/score.svg)](https://www.bithound.io/github/stephane-monnot/react-fake-code-typing) [![Dependency Status](https://david-dm.org/stephane-monnot/react-fake-code-typing.svg)](https://david-dm.org/stephane-monnot/react-fake-code-typing) | ||
|
||
# react-fake-code-typing - Fake code typing for React.js | ||
|
||
## Full documentation & Demo | ||
|
||
[React Fake Code Typing documentation](https://stephane-monnot.github.io/react-fake-code-typing/) | ||
|
||
|
||
## Install | ||
|
||
```code | ||
$ npm i react-fake-code-typing | ||
``` | ||
|
||
|
||
## Usage | ||
|
||
```code|lang-jsx | ||
--- | ||
import { FakeCodeTyping } from 'react-fake-code-typing'; | ||
import 'react-fake-code-typing/style.min.css'; | ||
const testCode = ` | ||
function setError($errorcode) { | ||
$this->errorcode = $errorcode; | ||
$this->error = $this->errors[$errorcode]; | ||
} | ||
} | ||
function getError($errormessage = '') { | ||
$error = $this->errorcode.$this->errormessage; | ||
return $error; | ||
exit; | ||
} | ||
/** | ||
* @link Home | ||
* @todo ..write a 404 page that actually makes sense. | ||
*/ | ||
$err->setError(404); | ||
$err->getError("Page Not Found");`; | ||
... | ||
<FakeCodeTyping> | ||
<pre> | ||
{testCode} | ||
</pre> | ||
</FakeCodeTyping> | ||
``` | ||
|
||
|
||
## FakeCodeTyping Props | ||
|
||
### `speed={ Number }` | ||
|
||
Typing speed (default: 12). | ||
|
||
|
||
## Showcase | ||
|
||
* Coming soon | ||
|
||
|
||
## For development | ||
### Launch the demo with catalog | ||
```code | ||
$ yarn start | ||
``` | ||
|
||
### Run the tests | ||
```code | ||
$ yarn test | ||
``` | ||
|
||
### Watch and Run the tests | ||
```code | ||
$ yarn test:watch | ||
``` | ||
|
||
### Run lint | ||
```code | ||
$ yarn test:lint | ||
``` | ||
|
||
### Publish new version (only for maintainers) | ||
```code | ||
$ yarn publish | ||
``` | ||
|
||
## License | ||
|
||
*react-fake-code-typing* is available under MIT. See LICENSE for more details. |
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,18 @@ | ||
import React from 'react'; | ||
import { | ||
renderIntoDocument, | ||
findRenderedDOMComponentWithClass | ||
} from 'react-dom/test-utils'; | ||
|
||
import FakeCodeTypingLine from '../src/FakeCodeTypingLine'; | ||
|
||
describe('FakeCodeTypingLine', function () { | ||
it('should have the fake-code-typing-line classname', function () { | ||
const component = renderIntoDocument( | ||
<FakeCodeTypingLine delay={2} duration={2} count={3} keepBorder={false}> | ||
test1 | ||
</FakeCodeTypingLine> | ||
); | ||
findRenderedDOMComponentWithClass(component, 'fake-code-typing-line'); | ||
}); | ||
}); |
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,16 @@ | ||
import React from 'react'; | ||
import { | ||
renderIntoDocument, | ||
findRenderedDOMComponentWithClass | ||
} from 'react-dom/test-utils'; | ||
|
||
import FakeCodeTyping from '../src/FakeCodeTyping'; | ||
|
||
describe('FakeCodeTyping', function () { | ||
it('should have the fake-code-typing classname', function () { | ||
const component = renderIntoDocument( | ||
<FakeCodeTyping><pre>test1</pre></FakeCodeTyping> | ||
); | ||
findRenderedDOMComponentWithClass(component, 'fake-code-typing'); | ||
}); | ||
}); |
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,3 @@ | ||
global.requestAnimationFrame = (callback) => { | ||
setTimeout(callback, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* eslint no-param-reassign: 0 */ | ||
module.exports = { | ||
webpack: (catalogWebpackConfig) => { | ||
catalogWebpackConfig.output.publicPath = ''; | ||
return catalogWebpackConfig; | ||
} | ||
}; |
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,12 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>React Fake Code Typing</title> | ||
</head> | ||
<body> | ||
<div id="catalog"></div> | ||
</body> | ||
</html> |
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,79 @@ | ||
/* eslint-disable global-require, import/no-unresolved, react/no-multi-comp */ | ||
/* eslint-disable no-irregular-whitespace */ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import GithubCorner from 'react-github-corner'; | ||
import { Catalog, CodeSpecimen, ReactSpecimen, pageLoader } from 'catalog'; | ||
import 'purecss/build/pure.css'; | ||
|
||
import { FakeCodeTyping } from '../src/index'; | ||
import './main.css'; | ||
import '../style.css'; | ||
|
||
const testCode = ` | ||
function setError($errorcode) { | ||
$this->errorcode = $errorcode; | ||
$this->error = $this->errors[$errorcode]; | ||
} | ||
} | ||
function getError($errormessage = '') { | ||
$error = $this->errorcode.$this->errormessage; | ||
return $error; | ||
exit; | ||
} | ||
/** | ||
* @link Home | ||
* @todo ..write a 404 page that actually makes sense. | ||
*/ | ||
$err->setError(404); | ||
$err->getError("Page Not Found");`; | ||
|
||
// Add your documentation imports here. These are available to | ||
// React specimen. Do NOT pass React here as Catalog does that. | ||
const documentationImports = {}; | ||
const pages = [ | ||
{ | ||
path: '/', | ||
title: 'Introduction', | ||
content: pageLoader(() => import('../README.md')) | ||
}, | ||
{ | ||
path: '/demo', | ||
title: 'Demo', | ||
content: () => ( | ||
<FakeCodeTyping> | ||
<pre> | ||
{testCode} | ||
</pre> | ||
</FakeCodeTyping> | ||
) | ||
} | ||
]; | ||
|
||
// Catalog - logoSrc="../images/logo.png" | ||
ReactDOM.render( | ||
<div> | ||
<GithubCorner | ||
href="https://github.com/stephane-monnot/react-fake-code-typing" | ||
bannerColor="#fff" | ||
octoColor="#000" | ||
width={80} | ||
height={80} | ||
direction="right" | ||
/> | ||
<Catalog | ||
imports={documentationImports} | ||
pages={pages} | ||
theme={{ background: '#e3e3e3' }} | ||
specimens={{ | ||
javascript: props => <CodeSpecimen {...props} lang="javascript" />, | ||
js: props => <CodeSpecimen {...props} lang="javascript" />, | ||
jsx: props => <ReactSpecimen {...props} /> | ||
}} | ||
title="Fake Code Typing" | ||
|
||
/> | ||
</div>, | ||
document.getElementById('catalog') | ||
); |
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,3 @@ | ||
.github-corner svg { | ||
z-index: 1000; | ||
} |
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 @@ | ||
/* eslint-disable */ | ||
// adapted based on rackt/history (MIT) | ||
// Node 0.10+ | ||
var execSync = require('child_process').execSync; | ||
var stat = require('fs').stat; | ||
|
||
// Node 0.10 check | ||
if (!execSync) { | ||
execSync = require('sync-exec'); | ||
} | ||
|
||
function exec(command) { | ||
execSync(command, { | ||
stdio: [0, 1, 2] | ||
}); | ||
} | ||
|
||
stat('dist-modules', function(error, stat) { | ||
// Skip building on Travis | ||
if (process.env.TRAVIS) { | ||
return; | ||
} | ||
|
||
if (error || !stat.isDirectory()) { | ||
exec('npm i babel-cli babel-preset-es2015 babel-preset-react'); | ||
exec('npm run dist:modules'); | ||
} | ||
}); |
Oops, something went wrong.