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

@pebblely/react

v0.0.1

Published

## Building and linking the package 1. Ensure `@pebblely/pebblely-js` and `@pebblely/shared` have been linked. 2. Build and link `@pebblely/react` ```bash npm link @pebblely/pebblely-js @pebblely/shared npm run build npm link ```

Downloads

3

Readme

@pebblely/react

Building and linking the package

  1. Ensure @pebblely/pebblely-js and @pebblely/shared have been linked.
  2. Build and link @pebblely/react
npm link @pebblely/pebblely-js @pebblely/shared
npm run build
npm link

Getting started

Ensure you have the Pebblely API key inside your .env file

PEBBLELY_API_KEY=YOUR_API_KEY

CreateBackground component

import { CreateBackground } from "@pebblely/react"

export default function Example() {
  return (
    <CreateBackground />
  )
}

Props

  1. buttonClassName: Optional. Style 'Create background' button.
  2. containerClassName: Optional. Style component container.
  3. imageInputLabel: Optional. Label for file input field.
  4. inputClassName: Optional. Style custom description input field.
  5. inputDescriptionLabel: Optional. Label for custom description field.
  6. selectThemeLabel: Optional. Label for theme selection component.
  7. styleColorLabel: Optional. Label for style color picker.
  8. styleImageLabel: Optional. Label for style image upload field.
  9. useCustomDescription: Optional. Choose between custom description or theme. Defaults to false.
  10. useCustomDimesion: Optional. Choose whether to display custom dimension input fields. Defaults to false.
  11. useStyleColor: Optional. Show color input. Defaults to false.
  12. useStyleImage: Optional. Allow style image uploads. Defaults to false.

PebblelyBasicContainer

This component gives a more flexible option to the developer for designing the experience around background creation. The following components are needed to successfully create a background:

  • Input image (name = 'inputImage')
  • Theme selector (name = 'theme') or custom description input field (name = 'description')
  • Style color (optional) (name = 'styleColor')
  • Style image (optional) (name = 'styleImage')
  • Output image dimensions' field (optional) (name = 'width' and name = 'height')
  • Image position input (use transformPosition and setTransformPosition parameters)

The package offers several components which can be used directly. But developers have the freedom to develop their own components as well. They just need to use the mentioned name attribute along with the corresponding input field.

import { 
  CreateBackground, 
  ImageDimensionInput, 
  ImageDragDrop, 
  PebblelyBasicContainer, 
  SelectThemeCombobox,
  StyleColorSelector,
} from "@pebblely/react"
import { TransformTemplates } from "@pebblely/pebblely-js"

export default function Home() {
  return (
    <main className="flex min-h-screen flex-col items-center justify-start p-24">
      <h1 className="text-xl mb-5">Create background component</h1>
      <CreateBackground 
        styleColorLabel="Style color"
        transformLabel="Product position"
        useCustomDimension={true}
        useStyleColor={true}
        useStyleImage={true}
        useTransform={true}
      />

      <PebblelyBasicContainer className="w-full space-y-4">
        {({ generatedImageSrc, isLoading, setTransformPosition, transformPosition }) => (
          <>
            {/* Input image field */}
            <ImageDragDrop />

            {/* Style image field */}
            <ImageDragDrop 
              styleImage={true}
            />

            {/* Theme selection autocomplete combobox */}
            <SelectThemeCombobox />

            {/* Output image dimension fields */}
            <ImageDimensionInput
              containerClassName="flex space-x-4 items-center"
              widthLabel="W"
              heightLabel="H"
              inputClassName="w-20 rounded-md py-1.5 px-3 text-gray-900"
            />

            {/* Input style color */}
            <div className="flex space-x-4 items-center">
              <label className="text-sm">
                Select style color
              </label>
              <StyleColorSelector 
                className="rounded-md px-1"
              />
            </div>

            {/* Select product position */}
            <div className='flex space-x-3 items-center'>
              <label className="text-sm">
                Product position
              </label>
              {Object.values(TransformTemplates).map(val => (
                <div
                  onClick={() => setTransformPosition(val)}
                  className={`${val === transformPosition ? 'bg-neutral-800' : ''} px-3 py-1.5 rounded text-sm border border-neutral-600 hover:bg-neutral-800 cursor-pointer`}
                  key={val}
                >
                  {val.toUpperCase()}
                </div>
              ))}
            </div>

            {/* Submit button */}
            <button
              className='px-5 py-1.5 w-full rounded-md bg-white text-black hover:bg-white/90 hover:shadow-xl shadow-white/40'
              type="submit"
            >
              Create background
            </button>

            {/* Show generated background */}
            {generatedImageSrc ? (
              <div className='w-full'>
                <img
                  src={generatedImageSrc}
                  alt="Generated image"
                />
              </div>
            ) : null}
          </>
        )}
      </PebblelyBasicContainer>
    </main>
  )
}