npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

highlightingtypingeffect

v1.0.4

Published

A React component that simulates a typing effect while highlighting specific words based on the provided JSON data. The component types out the content word-by-word and applies dynamic highlights with customizable colors.

Downloads

199

Readme

TypingEffectWithHighlights

A React component that simulates a typing effect while highlighting specific words based on the provided JSON data. The component types out the content word-by-word and applies dynamic highlights with customizable colors.

Features

  • Typing Effect: Displays text with a typewriter effect, revealing one word at a time.
  • Dynamic Word Highlighting: Highlight specific words based on indices and colors provided in the JSON object.
  • Customizable Typing Speed: Control the speed of the typing effect with an adjustable interval.
  • Customizable Highlight Colors: Supports dynamic background color and underline styles for highlighted words.

Installation

To install the package, run:

npm install typing-effect-with-highlights

How to Use

Importing the Component

You can import the TypingEffectWithHighlights component into your React application as follows:

import HighlightingTypingEffect from 'highlightingtypingeffect';

Passing Data to the Component

You need to pass a JSON object with the text content and highlight data to the component. The object should include:

  • json: An array of words that will be typed out.

Example Usage

import React from 'react';
import TypingEffectWithHighlights from 'typing-effect-with-highlights';

const MyComponent = () => {
 const json = {
  text: "Nowadays, in some countries, parents believe that if kids try hard, they will achieve their goals. In the following paragraphs, I will explain the pros and cons. On one hand, encouraging younger generations can support their success. Supportive actions help them promote cooperative feelings, which are essential for long-term goals. Asking them to try harder can foster a sense of responsibility, boosting their mental well-being and self-esteem. For example, in the USA, parents sometimes monitor kids by buying gifts, allowing them to make mistakes and learn the best path. On the other hand, unrealistic goals can harm children’s motivation if they cannot achieve them. Setting realistic targets is crucial to avoid damaging their mental health. Consulting a psychologist may help prevent depression. In India, some therapists emphasize choosing achievable goals for well-being. In conclusion, setting optimal and achievable targets is important for mental health and success.",
  corrections: [
    { start_index: 10, end_index: 22, color: "red" },
    { start_index: 44, end_index: 50, color: "blue" },
    { start_index: 74, end_index: 83, color: "green" },
    { start_index: 90, end_index: 109, color: "orange" },
    { start_index: 129, end_index: 141, color: "purple" },
    { start_index: 174, end_index: 185, color: "teal" },
    { start_index: 200, end_index: 218, color: "brown" },
    { start_index: 230, end_index: 245, color: "pink" },
    { start_index: 267, end_index: 285, color: "cyan" },
    { start_index: 305, end_index: 317, color: "yellow" }
  ]
};

  return (
    <div>
      <TypingEffectWithHighlights
        json={json}
       interval={100} // Speed at which the words are typed (ms per word)
      />
    </div>
  );
};

export default MyComponent;

Props

  • json: Object or a json file containing text and array of objects containing corrections
  • interval: Speed at which words are typed (in milliseconds per word).