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

@crave/farmblocks-map-balloon

v4.0.17

Published

Displays pictures and a caption over a map

Downloads

1,378

Readme

logo-farmblocks

Farmblocks Map Balloon

A React component to display pictures and a caption over a map. See [Storybook](https://cravefood.github.io/farmblocks/index.html?selectedKind=Map Balloon)

Installation

npm install @crave/farmblocks-map-balloon

Usage

import React from "react";
import ReactDOM from "react-dom";
import MapBalloon from "@crave/farmblocks-map-balloon";

const root = document.createElement("div");

ReactDOM.render(
  <div
    style={{
      position: "relative",
      width: 500,
      height: 500,
      background: "lightcyan",
    }}
  >
    <MapBalloon
      x={50}
      y={400}
      open
      caption="My Farm"
      imageSet={[
        {
          name: "Strawberries",
          image: "https://source.unsplash.com/eCre0iMGtEA/800x800",
          // Photo by Clem Onojeghuo
        },
      ]}
    />
  </div>,
  root,
);

document.body.appendChild(root);

API

  • x: number (default: 0). The x position of the pin, in pixels.
  • y: number (default: 0). The y position of the pin, in pixels.
  • align: string (default: 'left') The alignment of the balloon relative to the pin. You can use our constants by importing the alignments object:
    • import MapBalloon, { alignments } from "@crave/farmblocks-map-balloon";
  • singleImage: string. Path for a single image to be displayed in a smaller balloon without caption.
  • caption: string (required if singleImage is not used). Text to show under the images.
  • imageSet: array (required if singleImage is not used). The list of images to be displayed on a balloon. Items should be objects with the following properties:
    • name: string (required). Text to show over the the image.
    • image: string (required). Path to product image.
  • open: boolean (default: 0). Defines if the balloon wil be visible. Otherwise only the pin will be rendered
  • animated: boolean (default: false). Defines if the balloon is animated or not
  • balloonSize: number (default: 260). Balloon size
  • borderRadius: string (default: 8px). Defines the balloon border radius
  • pinColor: string (default: #f1c618). Color to be set to the pin icon
  • pinHighlightColor: string (defaults to the pinColor value). Color to be set to the highlighted pin
  • pinSize: number (default: 40). Size to be set to the pin icon
  • opacity: number (default: 1)
  • captionSize: number (default: 18), Size of the caption text.
  • imageTextSize: number (default: 28), Size of the text overlay on images.
  • onPinClick: function. Called when the pin is clicked. If set, changes the pin visual into a round button
  • onBalloonClick: function. Called when the balloon is clicked. If set, adds an indicator to the balloon text.
  • value: any. A value that will be passed as first argument for onPinClick and onBalloonClick calls. This can be handy to identify which pin/balloon was clicked.

License

MIT