Sha256: 0568ae533cd6ce4996b45036b7be3e46eb0a8a41332ea61fcc12087b2eb1e7eb

Contents?: true

Size: 1.19 KB

Versions: 544

Compression:

Stored size: 1.19 KB

Contents

/* @flow */

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

544 entries across 544 versions & 1 rubygems

Version Path
playbook_ui-13.21.0.pre.alpha.PLAY120322465 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.21.0.pre.alpha.pbntr220improveexpansionspeed2451 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.21.0.pre.alpha.PBNTR224letuserresetrowexpansion2441 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.21.0.pre.alpha.PBNTR225advancedtablefeedback2438 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.21.0.pre.alpha.PBNTR238DatePickerYearBug2436 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.21.0.pre.alpha.pbntr220improveexpansionspeed2431 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.21.0.pre.alpha.pbntr220improveexpansionspeed2415 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.20.0.pre.alpha.play1247htmloptions2404 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.20.0.pre.alpha.play1247htmloptions2403 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.20.0.pre.alpha.PLAY12572402 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.21.0 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.20.0.pre.alpha.PBNTR225advancedtablefeedback2375 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.19.0.pre.alpha.PBNTR200addadvancedtablekitdarkmodestyles2346 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.19.0.pre.alpha.play1174fixconfimationtoastmobilebug2345 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.19.0.pre.alpha.play1174fixconfimationtoastmobilebug2342 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.19.0.pre.alpha.play1186collapsiblenaviconcolorbug2321 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.19.0.pre.alpha.PBNTR211tablekitsubcomponentsreact2318 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.19.0.pre.alpha.play1174fixconfimationtoastmobilebug2306 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.19.0.pre.alpha.play1174fixconfimationtoastmobilebug2305 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx
playbook_ui-13.20.0 app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx