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

@nouance/payload-iframe-tabs-plugin

v1.0.2

Published

A plugin that easily allows you add iframes into separate tabs in the admin panel

Downloads

8

Readme

Payload Iframe Tabs Plugin

A plugin that easily allows you add iframes into separate tabs in the admin panel.

iframepluginshowcase (2)

Installation

  yarn add @nouance/payload-iframe-tabs-plugin
  # OR
  npm i @nouance/payload-iframe-tabs-plugin

Features

Supported tabs

Currently usage is the same for globals and collections as well.

Basic usage:

import iframeTabsPlugin from '@nouance/payload-iframe-tabs-plugin'

// ...

iframeTabsPlugin({
  enabled: true,
  collections: [
    {
      slug: 'examples',
      tabs: [
        {
          name: 'FirstYoutube',
          label: 'Michael Scott',
          path: '/michael-scott',
          src: 'https://www.youtube.com/embed/B9MNITrHu9E',
        },
      ],
    },
  ],
  globals: [
    {
      slug: 'Homepage',
      tabs: [
        {
          name: 'Spongebob',
          label: 'Spongebob',
          path: '/spongebob',
          src: 'https://www.youtube.com/embed/hzond0fF4MM',
          iframeProps: {
            height: 1080,
            width: 1920,
            frameBorder: '0',
            style: { aspectRatio: '19/10', maxWidth: '100%', height: 'auto' },
          },
        },
      ],
    },
  ],
}),

Base config

This config is required for all tabs.

  • name | required | A machine name used for the tab, it must be unique and preferably written in PascalCase

  • label | required

  • path | required | A unique path that dictates what URL this tab will be available in

Src

In src mode, you only need to provide the right link for the iframe to render its content. You can then pass an additional iframeProps to style and configure your iframe element.

  • src | required | Full URL to embeddable content

  • iframeProps | optional | HTML props for the Iframe element

globals: [
  {
    slug: 'Homepage',
    tabs: [
      {
        name: 'Spongebob',
        label: 'Spongebob',
        path: '/spongebob',
        src: 'https://www.youtube.com/embed/hzond0fF4MM',
        iframeProps: {
          height: 1080,
          width: 1920,
          frameBorder: '0',
          style: { aspectRatio: '19/10', maxWidth: '100%', height: 'auto' },
        },
      },
    ],
  },
],

Code

By providing code instead we will dangerously render any code you provide here.
Use with caution.

  • code | required | Full markup in string format to dangerously render
{
  name: 'FigmaDesign',
  label: 'Figma Design',
  path: '/design',
  code: `<iframe style="border: 1px solid rgba(0, 0, 0, 0.1); width: 100%; height: auto; aspect-ratio: 19/10;" width="800" height="450" src="https://www.figma.com/embed?embed_host=share&url=----------" allowfullscreen></iframe>`,
},

Dynamic

Dynamic mode is similar to src mode except that we can fetch your URL from a field value instead.

  • watchField | required | Field path to watch for updates

  • iframeProps | optional | HTML props for the Iframe element

{
  name: 'Dynamic',
  label: 'Dynamic',
  path: '/dynamic',
  watchField: 'source',
  iframeProps: {
    height: 1080,
    width: 1920,
    frameBorder: '0',
    style: { aspectRatio: '19/10', maxWidth: '100%', height: 'auto' },
  },
},

Contributing

For development purposes, there is a full working example of how this plugin might be used in the dev directory of this repo.

git clone [email protected]:NouanceLabs/payload-iframe-tabs-plugin.git \
  cd payload-iframe-tabs-plugin && yarn \
  cd dev && yarn \
  cp .env.example .env \
  vim .env \ # add your payload details
  yarn dev