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

react-modal-hover

v1.1.13

Published

<img src="shared/rmh.gif" alt="drawing" style="width:500px"/>

Downloads

118

Readme

react-modal-hover

How it works 🤔

Hovering over the desired component will open a modal with another component shown as information Take care with the width of the element you want to hover 🤟

There are 3 main elements on this component:

1 - Content: the element to show when user hover the element

2 - Legend: the element to make users know some element is hoverable

3 - Background: a black transparent window when you hover

🚀 Live Demo: https://onlyMastering.com/devmode

Quick Start

Install package from npm 📥

npm i react-modal-hover

Import it on your .js 📥

import { ModalHover } from 'react-modal-hover'

Prepare your "onHover" component or just a simple string

<ModalHover onHover={<h3>Hello World</h3>}>
  <div>Hover Me!</div>
<ModalHover/>

ℹ️ it's recommended to use <div> as first child, then whatever you want 😃

General Props

ℹ️ Main props of the component, legendMsg is ? because is the typical tooltip map legend ℹ️ if option active={false} ModalHover will not be even visible on the html

|Option|Type|Default|Description| |-------------|:-------------:|:-------------:|:-------------:| |active|boolean|true|activate all the hover option |legend|boolean|true|legend on top of your hover component |legendPos|string|right|position of the legend on your hover component |legendMsg|string|?|message of the legend

Example

<ModalHover onHover={<MySocialMediaComponent/>} legendPos="left" legendMsg="Follow me!">
  <div>Author: Carlos Torres</div>
<ModalHover/>

Styled Props (CSS)

ℹ️ Styling props, you can add it on objects or direct CSS, check examples below

BackgroundStyles

|Option|Type|Default|Description| |-------------|:-------------:|:-------------:|:-------------:| |backgroundColor|string|rgba(0, 0, 0, 0.75)|background-color, better with some transparency|

ContentStyles

|Option|Type|Default|Description| |-------------|:-------------:|:-------------:|:-------------:| |backgroundColor|string|rgba(0, 0, 0, 1)| content css property| |maxWidth|string|100%| content css property| |borderRadius|string|8px| content css property| |boxShadow|string|0 0 10px 2px black| content css property| |color|string|white| content css property| |padding|string|10px 20px| content css property| |border|string|2px solid grey| content css property| |marginLeft|string|20px| content css property| |marginRight|string|20px| content css property|

Example with object

const MyContentStyles = {
    backgroundColor: "white",
    color: "black",
    padding: "20px 40px"
}
...
<ModalHover ContentStyles={MyContentStyles} onHover={<MyCompOnHover/>} legendMsg="HOVER ME!">
  <div>Im a div that wants to be hovered</div>
<ModalHover/>

LegendStyles

|Option|Type|Default|Description| |-------------|:-------------:|:-------------:|:-------------:| |color|string|white| Legend css property| |backgroundColor|string|orange| Legend css property| |borderRadius|string|50px| Legend css property| |minHeight|string|20px| Legend css property| |minWidth|string|20px| Legend css property| |padding|string|2px 2px| Legend css property| |display|string|flex| Legend css property| |justifyContent|string|space-around| Legend css property| |alignItems|string|center| Legend css property| |cursor|string|pointer| Legend css property| |boxShadow|string|0 0 5px 0 black| Legend css property| |fontSize|string|16px| Legend css property| |fontWeight|string|bold| Legend css property| |marginTop|string|0px| Legend css property| |marginLeft|string|0px| Legend css property|

Example with direct css insert (just like in React)

<ModalHover
    ContentStyles={{color:"red", padding:"20px"}}
    LegendStyles={{backgroundColor:"red"}}
    onHover={<MyCompOnHover/>}
    legendMsg="info"
    >
  <div>Im other div that wants to be hovered</div>
<ModalHover/>

Fades

ℹ️ You can set fade-in/out props to the background and the content, do it carefully ⚠️ :

|Option|Type|Default|Description| |-------------|:-------------:|:-------------:|:-------------:| |backFadeIn|string|1s ease|recommended fade in for background| |backFadeOut|string|.3s ease|recommended fade out for background| |contFadeIn|string|1s ease|recommended fade in for content| |contFadeOut|string|.3s ease|recommended fade out for content|

Example with Fades

<ModalHover
    Fades={{backFadeIn:".5s linear", contFadeIn:".5s linear"}}
    legendMsg="info"
    >
  <div>Im other div that wants to be hovered</div>
<ModalHover/>

TypeScript

This package does support TypeScript 🥰

Follow me! ✨

GitHub | @carlostorreswav Twitter | @carlostorreswav Linkedin | Carlos Torres

TypeScript support thanks to @ciensprog 🧡