Socket
Socket
Sign inDemoInstall

@parameter1/base-cms-marko-web-photoswipe

Package Overview
Dependencies
287
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @parameter1/base-cms-marko-web-photoswipe

## Installation


Version published
Weekly downloads
1.5K
increased by288.11%
Maintainers
3
Created
Weekly downloads
 

Readme

Source

BaseCMS Marko Wrapper for Photoswipe

Installation

  1. Include @parameter1/base-cms-marko-web-photoswipe as a project/website dependency.

  2. Include the Browser plugin.

// your-site/browser/index.js
import PhotoSwipe from '@parameter1/base-cms-marko-web-photoswipe/browser';

PhotoSwipe(Browser);

export default Browser;
  1. Include the styles.
// your-site/server/styles/index.scss
@import "@parameter1/base-cms-marko-web-photoswipe/scss/main";
  1. If you're using the default theme (or something similar) you'll need to adjust the photoswipe z-index:
$pswp__root-z-index: $theme-site-header-z-index + 1 !default;
@import "@parameter1/base-cms-marko-web-photoswipe/scss/main";

Usage

You must specify a body gallery ID as well as an image selector.

  1. On the page contents, append a unique gallery ID and display some images, e.g.:
<default-theme-page-contents attrs={ "data-gallery-id": content.id }>
  <marko-web-page-image width=720 obj=content.primaryImage />
  <marko-web-content-body obj=content />
</default-theme-page-contents>
  1. Immediately after this block, load the gallery component:
import { getAsArray } from "@parameter1/base-cms-object-path";

$ const images = resolved.getEdgeNodesFor("images");

<marko-web-photoswipe-images images=images>
  <@props thumbnail-click-selectors=`[data-gallery-id="${id}"] [data-image-id]` />
</marko-web-photoswipe-images>
  1. Make sure you're returning the images from GraphQL
const gql = require('graphql-tag');

module.exports = gql`
fragment ContentPageFragment on Content {
  id
  name
  images(input:{ pagination: { limit: 100 }, sort: { order: values } }) {
    edges {
      node {
        id
        src
        alt
        displayName
        caption
        credit
      }
    }
  }
}
`;

FAQs

Last updated on 11 Feb 2024

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