Socket
Socket
Sign inDemoInstall

react-tiny-link

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-tiny-link

> Convert your links into beautiful previews


Version published
Weekly downloads
4.9K
increased by22.15%
Maintainers
1
Install size
421 kB
Created
Weekly downloads
 

Readme

Source

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

PropNameDescriptionPropTypevaluerequired
urlURL to be display as previewstringtrue
cardSizeSize of the cardstringdefault (small) small,largefalse
maxLineMaximum number of line to ellipsisnumber2false
minLineMinimum number of line to ellipsisnumber1false
widthWidth of the link preview cardnumberdefault(100vw)false
headerDefault Header contentstringnullfalse
descriptionDefault description contentstringnullfalse
proxyUrlProxy URL to pass that resolve CORSstringdefault(https://cors-anywhere.herokuapp.com)false
showGraphicBoolean value to display graphicsbooleandefault(true)false
autoPlayBoolean value to play the media if provided url is videobooleandefault(false)false
defaultMediaDefault value to provide the media for failure casesstringN.Afalse
noCacheDisables cache of link resultbooleandefault(false)false
onErrorError callback on when the url failed to fetchonError(error:Error)N.Afalse
onSuccessSuccess callback on when the url was fetched successfullyonSuccess(data:IResponseData)N.Afalse
onClickClick 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
loadSecureUrlLoad only secure ( https:// ) resources. If no secure resource was found, then don't render the <img> and <video> elementbooleandefault(false)false
requestHeadersRequest headers that will override the fetch headersRecord<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

PropNameDescriptionPropTypevaluerequired
urlURL to be display as previewstringtrue
proxyUrlProxy URL to pass that resolve CORSstringdefault(https://cors-anywhere.herokuapp.com)false
defaultMediasDefault value to provide the media for failure casesstring[]N.Afalse
defaultValueDefault response to provide for failure casesIReactTinyLinkDataN.Afalse
noCacheDisables cache of link resultbooleandefault(false)false
onErrorError callback on when the url failed to fetchonError(error:Error)N.Afalse
onSuccessSuccess callback on when the url was fetched successfullyonSuccess(data:IResponseData)N.Afalse

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):


Vladimir Moushkov

💻

Serhii Khoma

💻 🐛

Hitesh Kumar

💻 🐛

VadymMoiseyenkoAgiliway

💻 🐛

nastikue

🐛

sndsabin

💻 🐛

Aviskar KC

🐛 💻

Alexandre Bernard

🐛 💻

Liz

💻 💡

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

License

MIT

Twitter Follow

Keywords

FAQs

Last updated on 02 Feb 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc