├── .babelrc ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── example ├── .env ├── .gitignore ├── README.md ├── package.json ├── public │ └── index.html └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── components │ ├── BasicExample.js │ ├── ColorExample.js │ └── FontExample.js │ ├── index.css │ └── index.js ├── lib └── ReactBlinkText.js ├── package.json ├── src ├── ReactBlinkText.css └── ReactBlinkText.js └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "react", 4 | "env", 5 | "stage-0" 6 | ] 7 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | /node_modules 3 | /.pnp 4 | .pnp.js 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | demo 3 | .babelrc 4 | webpack.config.js -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 10secondsofcode 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React Blink 2 | 3 | This reusable React component will manage to blink any text and changing the text color and font size if we need. 4 | 5 | `Blink` takes plain HTML tags and outputs plain HTML tags. It's dead simple, and React beginner friendly. 6 | 7 | ## Example 8 | 9 | ``` 10 | import React, { Component } from "react"; 11 | import Blink from 'react-blink-text'; 12 | 13 | function Application(){ 14 | return ( 15 |
16 | 17 | Testing the Blink 18 | 19 |
20 | ); 21 | } 22 | export default Application; 23 | ``` 24 | 25 | ## Features 26 | 1. Supports all html tags : H1, H2, h3,..,etc., Span, Div, A Href tag. 27 | 2. Supports all different types of colors 28 | 3. Supports server-side rendering. 29 | 30 | ## Installation 31 | 32 | ### Yarn: 33 | ``` 34 | yarn add react-blink-text 35 | ``` 36 | 37 | ### npm: 38 | ``` 39 | npm install --save react-blink-text 40 | ``` 41 | -------------------------------------------------------------------------------- /example/.env: -------------------------------------------------------------------------------- 1 | SKIP_PREFLIGHT_CHECK=true -------------------------------------------------------------------------------- /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 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `npm run build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "^16.10.2", 7 | "react-blink-text": "^1.0.3", 8 | "react-dom": "^16.10.2", 9 | "react-scripts": "3.2.0", 10 | "react-syntax-highlighter": "^11.0.2" 11 | }, 12 | "scripts": { 13 | "start": "react-scripts start", 14 | "build": "react-scripts build", 15 | "test": "react-scripts test", 16 | "eject": "react-scripts eject" 17 | }, 18 | "eslintConfig": { 19 | "extends": "react-app" 20 | }, 21 | "browserslist": { 22 | "production": [ 23 | ">0.2%", 24 | "not dead", 25 | "not op_mini all" 26 | ], 27 | "development": [ 28 | "last 1 chrome version", 29 | "last 1 firefox version", 30 | "last 1 safari version" 31 | ] 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /example/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Demo for React Blink Text 7 | 8 | 9 | 10 |
11 | 12 |
13 | 14 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /example/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | margin: 0 auto; 3 | max-width: 800px; 4 | text-align: left; 5 | } 6 | 7 | .App-header { 8 | background-color: #282c34; 9 | min-height: 100vh; 10 | display: flex; 11 | flex-direction: column; 12 | align-items: center; 13 | justify-content: center; 14 | font-size: calc(10px + 2vmin); 15 | color: white; 16 | } 17 | 18 | .App-link { 19 | color: #09d3ac; 20 | } 21 | -------------------------------------------------------------------------------- /example/src/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import './App.css'; 3 | import BasicExample from './components/BasicExample'; 4 | import ColorExample from './components/ColorExample'; 5 | import FontExample from './components/FontExample'; 6 | 7 | function App() { 8 | return ( 9 |
10 |

Demo for React Blink Text

11 | 12 | 13 | 14 |
15 | ); 16 | } 17 | 18 | export default App; 19 | -------------------------------------------------------------------------------- /example/src/App.test.js: -------------------------------------------------------------------------------- 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/components/BasicExample.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import Blink from "react-blink-text"; 3 | // import Blink from "../../../lib/ReactBlinkText"; 4 | import SyntaxHighlighter from "react-syntax-highlighter"; 5 | import { nord } from "react-syntax-highlighter/dist/esm/styles/hljs"; 6 | 7 | function BasicExample() { 8 | const [state, setState] = useState({ 9 | blinkTime: 1, 10 | textAlign: "left", 11 | fontWeight: "bolder", 12 | textTransform: "none", 13 | textDecoration: "none", 14 | letterSpacing: "2px" 15 | }); 16 | const handler = event => { 17 | setState({ ...state, [event.target.name]: event.target.value }); 18 | }; 19 | return ( 20 |
21 |

Basic Example

22 | 27 |

28 | 37 |

38 | 46 |

47 | 58 |

59 | 69 |
70 | 74 | 75 | <Blink text='Basic Blinking Text' /> 76 | 77 | Output: 78 | 79 | 88 |
89 | ); 90 | } 91 | 92 | export default BasicExample; 93 | -------------------------------------------------------------------------------- /example/src/components/ColorExample.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Blink from 'react-blink-text'; 3 | import SyntaxHighlighter from 'react-syntax-highlighter'; 4 | import { nord } from 'react-syntax-highlighter/dist/esm/styles/hljs'; 5 | 6 | function ColorExample() { 7 | return ( 8 |
9 |

Color

10 | 11 | <Blink text='Colored Blinking Text' color='blue'/> 12 | 13 | Output:
14 | 15 |
16 | ); 17 | } 18 | 19 | export default ColorExample; 20 | -------------------------------------------------------------------------------- /example/src/components/FontExample.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Blink from 'react-blink-text'; 3 | import SyntaxHighlighter from 'react-syntax-highlighter'; 4 | import { nord } from 'react-syntax-highlighter/dist/esm/styles/hljs'; 5 | 6 | function FontExample() { 7 | return ( 8 |
9 |

Font

10 | 11 | <Blink text='Blinking Text with Font Size 30' fontSize='30'/> 12 | 13 | Output:
14 | 15 |
16 | ); 17 | } 18 | 19 | export default FontExample; 20 | -------------------------------------------------------------------------------- /example/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | text-align: center; 4 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 5 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 6 | sans-serif; 7 | -webkit-font-smoothing: antialiased; 8 | -moz-osx-font-smoothing: grayscale; 9 | } 10 | -------------------------------------------------------------------------------- /example/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | 6 | ReactDOM.render(, document.getElementById('root')); 7 | -------------------------------------------------------------------------------- /lib/ReactBlinkText.js: -------------------------------------------------------------------------------- 1 | module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;nR.length&&R.push(e)}function I(e,t,n){return null==e?0:function e(t,n,r,o){var a=typeof t;"undefined"!==a&&"boolean"!==a||(t=null);var c=!1;if(null===t)c=!0;else switch(a){case"string":case"number":c=!0;break;case"object":switch(t.$$typeof){case i:case u:c=!0}}if(c)return r(o,t,""===n?"."+A(t,0):n),1;if(c=0,n=""===n?".":n+":",Array.isArray(t))for(var l=0;l 26 | 30 | {text} 31 | 32 | 33 | ); 34 | } 35 | } 36 | ReactBlinkText.propTypes = { 37 | /** hex color */ 38 | color: PropTypes.string, 39 | blinkTime: PropTypes.number, 40 | fontStyle: "normal" | "italic" | "oblique", 41 | fontWeight: PropTypes.number | "normal" | "bold" | "lighter", 42 | textTransform: PropTypes.string 43 | }; 44 | 45 | ReactBlinkText.defaultProps = { 46 | color: "#7f58af", 47 | fontSize: 55, 48 | text: "React Blink", 49 | background: "transparent", 50 | opacity: 1, 51 | blinkTime: 1, 52 | fontStyle: "normal", 53 | textTransform: "none" 54 | }; 55 | 56 | export default ReactBlinkText; 57 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | module.exports = { 4 | mode: 'production', 5 | entry: './src/ReactBlinkText.js', 6 | output: { 7 | path: path.resolve('lib'), 8 | filename: 'ReactBlinkText.js', 9 | libraryTarget: 'commonjs2' 10 | }, 11 | module: { 12 | rules: [ 13 | { 14 | test: /\.js?$/, 15 | exclude: /(node_modules)/, 16 | use: 'babel-loader' 17 | }, 18 | { 19 | test: /\.css$/i, 20 | use: ['style-loader', 'css-loader'], 21 | } 22 | ] 23 | } 24 | } --------------------------------------------------------------------------------