Git Product home page Git Product logo

react-sparkle's People

Contributors

dependabot[bot] avatar kmjennison avatar npretto avatar sangaline avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-sparkle's Issues

Demo needed

This looks great! Could we have a link to demo please?

Issue with React 17

npm i react-sparkle
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"17.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from [email protected]
npm ERR! node_modules/react-sparkle
npm ERR!   react-sparkle@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Error: Super expression must either be null or a function on Next.js Typescript

i want to use it in h2 classname mondwest and itallic but it show some error:
Error: Super expression must either be null or a function

i don't know what that is because it's my first time using next.js and i search up for that error but it shows other problems.

please help!

i have a code like this


const About = () => {
  return (
    <>
        <div className="w-full px-10 text-neutral-600 pt-[50px]">
            <p className="text-[80px] leading-[5rem] helvetica mb-3">HELLO, THIS IS KLAW⁘. <br /> A JUNIOR PROGRAMMER & <br /> 
            <span className='relative'>
              <h2 className='mondwest italic text-[100px]'>dIgiTal ArTiSt </h2>
            </span>
            </p>
            <p className="text-[12px] leading-[1rem] helvetica">BASED IN BEKASI _ INDONESIA<br></br>WORKING WORLDWIDE</p>
            <div className='flex space-x-5 mt-20'>
              <div className="flex flex-col mb-10">
                  <a href="https://github.com/klawcodes" target="_blank" rel="noopener noreferrer">
                    <Image src="/img/klaw.png" width={300} height={300} alt='klaw' className='rounded-3xl'/>
                  </a>
                  <hr className='h-px mt-5 bg-gray-900 border-0 dark:bg-gray-900'/>
                  <p className='text-[12px] py-[0.9rem] helvetica'>FRONT END DEVELOPER - JUNIOR PROGRAMMER</p>
                  <h2 className='text-[19px] helvetica'>KLAW</h2>
              </div>
              <div className="flex flex-col">
                  <a href="https://github.com/klawcodasdasdes" target="_blank" rel="noopener noreferrer">
                    <Image src="/img/riot.png" width={300} height={300} alt='klaw' className='rounded-3xl'/>
                  </a>
                  <hr className='h-px mt-5 bg-gray-900 border-0 dark:bg-gray-900'/>
                  <p className='text-[12px] py-[0.9rem] helvetica'>3D DESIGNER - DIGITAL ARTIST</p>
                  <h2 className='text-[19px] helvetica'>RIOT REVENGER</h2>
              </div>
              <div className="flex flex-col">
                  <a href="https://github.com/klawcodasdasdes" target="_blank" rel="noopener noreferrer">
                    <Image src="/img/npk.png" width={300} height={300} alt='klaw' className='rounded-3xl'/>
                  </a>
                  <hr className='h-px mt-5 bg-gray-900 border-0 dark:bg-gray-900'/>
                  <p className='text-[12px] py-[0.9rem] helvetica'>GRAPHIC DESIGNER - DIGITAL ARTIST</p>
                  <h2 className='text-[19px] helvetica'>NEON PAPER KID</h2>
              </div>
              <div className="flex flex-col">
                  <a href="https://github.com/klawcodasdasdes" target="_blank" rel="noopener noreferrer">
                    <Image src="/img/mk.png" width={300} height={300} alt='klaw' className='rounded-3xl'/>
                  </a>
                  <hr className='h-px mt-5 bg-gray-900 border-0 dark:bg-gray-900'/>
                  <p className='text-[12px] py-[0.9rem] helvetica'>MUSIC PRODUCER</p>
                  <h2 className='text-[19px] helvetica'>MIDNIGHT KOALA</h2>
              </div>
            </div>
        </div>
    </>
  )
}

export default About

Use `borderBoxSize` instead of `contentReact` when finding parent size?

The current code used contentRect to determine the size of the parent which then determines the canvas size. This excludes the border and padding of the parent which I don't think is the desired effect, at least in cases where box-sizing is border-box such as for buttons. The rough gist of a fix looks like

--- a/react-sparkle/src/SparkleComponent.js
+++ b/react-sparkle/src/SparkleComponent.js
@@ -225,11 +225,11 @@ class Sparkle extends React.Component {
       // If we refactor this, use an array iteration instead.
       // eslint-disable-next-line no-restricted-syntax
       for (const entry of entries) {
-        const { width, height } = entry.contentRect
+        const { inlineSize: width, blockSize: height } = entry.borderBoxSize[0]
         self.sizeCanvas(width, height)
       }
     })
-    ro.observe(this.sparkleWrapper.parentNode)
+    ro.observe(this.sparkleWrapper.parentNode, {box: 'border-box'})
   }

but there are a couple of subtle points. Should this be the only possible behavior, should it depend on the computed box-sizing style of the parent, or should it be controlled via a prop? The above code also assumes a horizontal writing mode, so to support top-to-bottom languages then I think you would want to get the parent's computed writing-mode and swap the width/height mapping if it is not equal to horizontal-tb.

React 18 peer dependency update request

I've updated my project to React 18 and I have to use npm update --legacy-peer-deps due to React Sparkle v1.0.9 (latest) having the following peer dependency constraints:

  "peerDependencies": {
    "react": ">=16.8.0 <18"
  }

React Sparkle seems to work just fine on React 18, though I admit I've not done exhaustive testing.


Noting that this is the error that comes up when running a plain ol' npm update:

npm ERR! Could not resolve dependency:
npm ERR! peer react@">=16.8.0 <18" from [email protected]
npm ERR! node_modules/react-sparkle
npm ERR!   react-sparkle@"^1.0.9" from the root project

interested in typescript typings?

Hello!
I'm migrating my personal website to typescript and I created some typescript typings for your wonderful lib, right know they're local in my project. Would you be interested in having them integrated in the lib? If so I'm more than happy to make a PR for that, just making sure it's ok before I do that as they then would need to be kept in sync with the actual props.
If you prefer I can just make the pr towards definitelyTyped but as end user I usually prefer typings to be inside the lib.

This is the d.ts file so far:

declare module "react-sparkle" {
  import React from "react";

  export interface ReactSparkleProps {
    /**
     * The color of the sparkles. Can be a color, an array of colors,
     * or 'random' (which will randomly pick from all hex colors).
     */
    color?: string | string[];

    /** The number of sparkles to render. A large number could slow
     *  down the page. */
    count?: number;

    /** The minimum and maximum diameter of sparkles, in pixels. */
    minSize?: number;
    maxSize?: number;

    /** The number of pixels the sparkles should extend beyond the
     *  bounds of the parent element.
     */
    overflowPx?: number;

    /** How quickly sparkles disappear; in other words, how quickly
     *  new sparkles are created. Should be between 0 and 1000,
     *  with 0 never fading sparkles out and 1000 immediately
     *  removing sparkles. Most meaningful speeds are between
     *  0 and 150.
     */
    fadeOutSpeed?: number;

    /** Whether we should create an entirely new sparkle when one
     *  fades out. If false, we'll just reset the opacity, keeping
     *  all other attributes of the sparkle the same.
     */
    newSparkleOnFadeOut?: boolean;

    /** Whether sparkles should have a "flickering" effect. */
    flicker?: boolean;

    /** How quickly the "flickering" should happen.
     *  One of: 'slowest', 'slower', 'slow', 'normal', 'fast', 'faster', 'fastest'
     */
    flickerSpeed?:
      | "slowest"
      | "slower"
      | "slow"
      | "normal"
      | "fast"
      | "faster"
      | "fastest";
  }

  export default class ReactSparkle extends React.Component<ReactSparkleProps> {}
}


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.