Sha256: 9f18d189cd6e68a44a3040dd4d3bebd413be3f34e03bb4665b7a2bd259b4c77e

Contents?: true

Size: 1.17 KB

Versions: 479

Compression:

Stored size: 1.17 KB

Contents

import React from 'react'
import { noop } from 'lodash'
import { TransformComponent, TransformWrapper } from 'react-zoom-pan-pinch'
import Image from '../../pb_image/_image'

type SlideType = {
  alt?: string,
  current?: number,
  onClick: () => void,
  onChange?: (index: number) => void,
  onZoom: (zoom: boolean) => void,
  zooming: boolean,
  url: string,
}

export default function Slide({
  alt,
  onClick = noop,
  onZoom = noop,
  url,
  zooming = false,
}: SlideType): React.ReactElement {
  const handlePinchingStop = ({state}: {state: any}) => {
    const isZooming = state.scale > 1
    onZoom(isZooming)
  }

  return (
    <TransformWrapper
        doubleClick={{ mode: 'reset' }}
        initialScale={1}
        onPinchingStop={handlePinchingStop}
        panning={{ disabled: !zooming }}
    >
      <button
          className="Slide"
          onClick={onClick}
          onDoubleClick={() => onZoom(false)}
          tabIndex={-1}
      >
        <TransformComponent wrapperClass="TransformComponent">
          <Image
              alt={alt}
              url={url}
              zIndex={3}
          />
        </TransformComponent>
      </button>
    </TransformWrapper>
  )
}

Version data entries

479 entries across 479 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5437 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR719listdraggablesimple5432 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR768stickyrightcolumn5431 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.12.0.pre.rc.6 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5415 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5413 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.12.0.pre.rc.5 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5409 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5400 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5392 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx