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

let-react-tiny-link

v3.6.3

Published

> Convert your links into beautiful previews

Downloads

3

Readme

React-Tiny-Link

Convert your links into beautiful previews

Yet anotherReact link preview component with cards for web without a specific backend.

npm version npm GitHub code size in bytes NPM

All Contributors

NPM

CORS enabled?

No. You may need a CORS proxy to use this component. But if you dont have one, we made the component to use https://cors-anywhere.herokuapp.com as default proxy. Thanks to Rob. It saves my time for accessing urls.

Installation


npm install --save react-tiny-link

Usage & Configuration

import { ReactTinyLink } from 'react-tiny-link'
;<ReactTinyLink
  cardSize="small"
  showGraphic={true}
  maxLine={2}
  minLine={1}
  url="https://www.amazon.com/Steve-Madden-Mens-Jagwar-10-5/dp/B016X44MKA/ref=lp_18637582011_1_1?srs=18637582011&ie=UTF8&qid=1550721409&sr=8-1"
/>

Props & methods

| PropName | Description | PropType | value | required | | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | ---------------------------------------------- | -------- | | url | URL to be display as preview | string | | true | | cardSize | Size of the card | string | default (small) small,large | false | | maxLine | Maximum number of line to ellipsis | number | 2 | false | | minLine | Minimum number of line to ellipsis | number | 1 | false | | width | Width of the link preview card | number | default(100vw) | false | | header | Default Header content | string | null | false | | description | Default description content | string | null | false | | proxyUrl | Proxy URL to pass that resolve CORS | string | default(https://cors-anywhere.herokuapp.com) | false | | showGraphic | Boolean value to display graphics | boolean | default(true) | false | | autoPlay | Boolean value to play the media if provided url is video | boolean | default(false) | false | | defaultMedia | Default value to provide the media for failure cases | string | N.A | false | | noCache | Disables cache of link result | boolean | default(false) | false | | onError | Error callback on when the url failed to fetch | onError(error:Error) | N.A | false | | onSuccess | Success callback on when the url was fetched successfully | onSuccess(data:IResponseData) | N.A | false | | onClick | Click event which will allow to add custom implementation onClick event if it was not provided the component itself will render as <a></a>. | onClick(e:Event,data:IResponseData) | default(null) | false | | loadSecureUrl | Load only secure ( https:// ) resources. If no secure resource was found, then don't render the <img> and <video> element | boolean | default(false) | false | | requestHeaders | Request headers that will override the fetch headers | Record<string, string>; | default(false) | false |

Hook usage

import { useScrapper } from 'react-tiny-link'

const [result, loading, error] = useScrapper({
  url:
    'https://www.amazon.com/Steve-Madden-Mens-Jagwar-10-5/dp/B016X44MKA/ref=lp_18637582011_1_1?srs=18637582011&ie=UTF8&qid=1550721409&sr=8-1',
})

Params

| PropName | Description | PropType | value | required | | ----------------- | --------------------------------------------------------- | ------------------------------- | ---------------------------------------------- | -------- | | url | URL to be display as preview | string | | true | | proxyUrl | Proxy URL to pass that resolve CORS | string | default(https://cors-anywhere.herokuapp.com) | false | | defaultMedias | Default value to provide the media for failure cases | string[] | N.A | false | | defaultValue | Default response to provide for failure cases | IReactTinyLinkData | N.A | false | | noCache | Disables cache of link result | boolean | default(false) | false | | onError | Error callback on when the url failed to fetch | onError(error:Error) | N.A | false | | onSuccess | Success callback on when the url was fetched successfully | onSuccess(data:IResponseData) | N.A | false |

Demo App &

CodeSandbox

Edit React Tiny Link

Contributing

  1. Fork it

  2. Create your feature branch (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Added some feature')

  4. Push to the branch (git push origin my-new-feature)

  5. Create new Pull Request

Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT

Twitter Follow