Socket
Socket
Sign inDemoInstall

unsplash-image-picker

Package Overview
Dependencies
8
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    unsplash-image-picker

Provide component to search and choose image from unsplash images


Version published
Weekly downloads
143
increased by107.25%
Maintainers
1
Install size
441 kB
Created
Weekly downloads
 

Readme

Source

unsplash-image-picker

Provide component to search and choose image from unsplash images

npm JavaScript Style Guide Hits

Live Demo

Live Demo Code Sandbox

Install

npm install --save unsplash-image-picker

Usage

Package provide 2 component to search and choose image from unsplash images.

  • UnsplashImagePicker - search and choose image from unsplash images
  • UnsplashImagePickerModal - Display modal to search and choose image from unsplash images

How to use UnsplashImagePickerModal

import React, { Component } from 'react'
import UnsplashImagePickerModal from 'unsplash-image-picker'
import 'unsplash-image-picker/dist/index.css'

const App = () => {
  const [active, setActive] = React.useState(false)
  const unsplashAccessKey = 'UNSPLASH_ACCESS_KEY'
  const [photos, SetPhotos] = React.useState([])
  return (
    <div>
      <button
        onClick={() => {
          setActive(true)
        }}
      >
        Show Picker
      </button>
      <UnsplashImagePickerModal
        unsplashAccessKey={unsplashAccessKey}
        active={active}
        setActive={setActive}
        initialPhotoSearchQuery=''
        onPhotoSelect={(photo) => {
          let list = photos ?? []
          list.push(photo)
          SetPhotos(list)
          setActive(false)
        }}
      />
    </div>
  )
}

How to use UnSplashImagePicker

import React from 'react'
import 'unsplash-image-picker/dist/index.css'
import { UnSplashImagePicker } from 'unsplash-image-picker'

const App = () => {
  const [photos, setPhotos] = React.useState([])
  const unsplashAccessKey = 'UNSPLASH_ACCESS_KEY'
  return (
    <div className='App '>
      <UnSplashImagePicker
        unsplashAccessKey={unsplashAccessKey}
        initialPhotoSearchQuery=''
        onPhotoSelect={(photo) => {
          let list = photos ?? []
          list.push(photo)
          SetPhotos(list)
        }}
      />
    </div>
  )
}

export default App

To get UNSPLASH ACCESS KEY, you can register at unsplash.com

License

MIT © thealphamerc

Keywords

FAQs

Last updated on 24 Sep 2022

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