├── .editorconfig ├── .gitignore ├── .prettierrc ├── .travis.yml ├── README.md ├── example ├── .gitignore ├── README.md ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ └── manifest.json ├── src │ ├── App.test.tsx │ ├── App.tsx │ ├── index.css │ ├── index.tsx │ ├── react-app-env.d.ts │ └── serviceWorker.ts ├── tsconfig.json └── yarn.lock ├── package.json ├── rollup.config.js ├── src ├── index.tsx └── test.ts ├── tsconfig.json ├── tsconfig.test.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # See https://help.github.com/ignore-files/ for more about ignoring files. 3 | 4 | # dependencies 5 | node_modules 6 | 7 | # builds 8 | build 9 | dist 10 | .rpt2_cache 11 | 12 | # misc 13 | .DS_Store 14 | .env 15 | .env.local 16 | .env.development.local 17 | .env.test.local 18 | .env.production.local 19 | 20 | npm-debug.log* 21 | yarn-debug.log* 22 | yarn-error.log* 23 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "overrides": [ 4 | { 5 | "files": "rollup.config.js", 6 | "options": { "semi": false } 7 | } 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 9 4 | - 8 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # use-typing-effect 2 | 3 | > React hook for emulating a person typing; great for landing pages, input placeholders and more! 4 | 5 | [![NPM](https://img.shields.io/npm/v/use-typing-effect.svg)](https://www.npmjs.com/package/use-typing-effect) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) 6 | 7 | ![demo](https://media.giphy.com/media/5YkXhqD4SDmSR1Y2Ae/giphy.gif) 8 | 9 | [DEMO](https://hermanya.github.io/use-typing-effect/) 10 | 11 | ## Install 12 | 13 | ```bash 14 | npm install --save use-typing-effect 15 | ``` 16 | 17 | ## Usage 18 | 19 | ```tsx 20 | import * as React from 'react'; 21 | 22 | import useTypingEffect from 'use-typing-effect'; 23 | 24 | const Example = () => { 25 | const heading = useTypingEffect(['Some text here', 'More text here'], { 26 | loop: true 27 | }); 28 | return

{heading}

; 29 | }; 30 | ``` 31 | 32 | ## License 33 | 34 | MIT © [Hermanya](https://github.com/Hermanya) 35 | 36 | --- 37 | 38 | This hook is created using [create-react-hook](https://github.com/hermanya/create-react-hook). 39 | 40 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `npm start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `npm test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `npm run build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `npm run eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@types/jest": "24.0.9", 7 | "@types/node": "11.10.4", 8 | "@types/react": "16.8.6", 9 | "@types/react-dom": "16.8.2", 10 | "react": "link:../node_modules/react", 11 | "react-dom": "16.8.3", 12 | "react-scripts": "2.1.5", 13 | "typescript": "3.3.3333", 14 | "use-typing-effect": "link:.." 15 | }, 16 | "scripts": { 17 | "start": "react-scripts start", 18 | "build": "react-scripts build", 19 | "test": "react-scripts test", 20 | "eject": "react-scripts eject" 21 | }, 22 | "eslintConfig": { 23 | "extends": "react-app" 24 | }, 25 | "browserslist": [ 26 | ">0.2%", 27 | "not dead", 28 | "not ie <= 11", 29 | "not op_mini all" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /example/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hermanya/use-typing-effect/681ee53c4c07afd24b11623503b57718e57538c9/example/public/favicon.ico -------------------------------------------------------------------------------- /example/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 15 | 16 | 25 | React App 26 | 32 | 33 | 34 | 35 |
36 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /example/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /example/src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useTypingEffect } from 'use-typing-effect'; 3 | 4 | const example = ` 5 | import * as React from 'react' 6 | 7 | import useTypingEffect from 'use-typing-effect' 8 | 9 | const Example = () => { 10 | const heading = useTypingEffect([ 11 | 'Some text here', 12 | 'More text here', 13 | ], {loop: true}) 14 | return ( 15 |

{heading}

16 | ) 17 | } 18 | `.trim(); 19 | 20 | const Command: React.StatelessComponent<{ 21 | className?: string; 22 | children: string; 23 | }> = ({ children, className }) => ( 24 | 30 | ); 31 | 32 | const App = () => { 33 | const heading = useTypingEffect( 34 | [ 35 | '“Human typing” effect', 36 | 'React hook...', 37 | 'Best react hook!', 38 | 'Star on github!', 39 | 'Use in production!' 40 | ], 41 | { loop: true } 42 | ); 43 | const comment = useTypingEffect([ 44 | '// Nice, eh?', 45 | '// Simple API', 46 | '// Easy to use' 47 | ]); 48 | 49 | return ( 50 |
51 |
52 |
53 |

{heading}

54 |

55 | npm install use-typing-effect 56 | yarn add use-typing-effect 57 | 61 | npm 62 | 63 | 67 | github 68 | 69 |

70 |
71 |
72 |