0.0.27 • Published 3 years ago

@dybo-io/dybo-sixty-1 v0.0.27

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

dybo-sixty

Install

npm i @dybo-io/dybo-sixty-1

Usage

Simple

Here is the simplest case of using dybo-sixty. You just need to specify the skuID, a valid dybo API Key and current Features to be loaded

Sample code:

import React from "react";
import { DyboSixty } from "@dybo-io/dybo-sixty-1";

const Example = () => (
  <div className={styles.dyboSixty}>
    <DyboSixty
      dyboAPIKey={apiKey}
      skuID={skuID}
      ref={dyboSixtyRef}
      inverse
      mousewheel
      hintOnStartup={true}
      jumpDelay={10}
      touchDragInterval={1}
      currentFeatures={features}
      zoomFactor={4}
      onSKUDataLoaded={(skuData) => // console.log(skuData)}
      OnThumbnailLoaded={(url) => {
        // console.log(url);
      }}
    />
  </div>
);

SKU data object returned from DyboSixty onSKUDataLoaded prop event has following structure:

{
  sku_id: "dybo sku_id",
  name: "client unique sku id",
  friendly_name: "Friendly name to displayed in UI",
  category: "SKU Category",
  features: [
    {
      name: "FEATURE_NAME",
      friendly_name: "Friendly name to displayed in UI",
      options: [
        {
          category: "option category",
          values: [
            {
              unique_name: "option code to be sent to dybo-server",
              friendly_name: "Friendly name to displayed in UI",
              thumbnail: "image url for thumbnail",
            },
            //...similar objects
          ],
        },
        //...similar objects
      ],
    },
    //...similar objects
  ],
  client_name: "Client name",
};

Props

Prop NameProp TypeDefault ValueRequired?Description
skuIDstringnullyesSKU ID on dybo's server
dyboAPIKeystringnullyesAPI Key for dybo server
currentFeaturesobjectnullyescurrent Features to be requested from the server - exa: {feature1 : "option1", feature2 : "option2", ...}
classNamestringundefinednoAdd class name for the component
styleobjectundefinednoAdd style for the component
hintOnStartUpbooleanfalsenoEnable/disable hint on start up
hintTextstringundefinednoEnable/disable hint text
touchbooleantruenoEnable/disable touch support
mousewheelbooleanfalsenoEnable/disable mousewheel support
inversebooleanfalsenoSwap image rotation direction. Affects mouse drag, mousewheel and touch
dragIntervalnumber1noAdjust rotation speed for mouse drag events
touchDragIntervalnumber2noAdjust rotation speed for touch events
mouseleaveDetectbooleanfalsenoIf true, active drag event will stop whenever mouse cursor leaves DyboSixty containernumber3nomaximum zoom value
renderHintfuncundefinednorender a customized hint message
jumpDelaynumber70nointerval to switch between frames using goToFrame prop event
zoomFactornumber2nozoom intensity when clicked

Prop Events

Prop NameParams TypeDescription
onHintHidenullHint is hidden
onAutoplayStartnullAutoplay is started
onAutoplayStopnullAutoplay is stopped
onNextMovenullNext image is loaded (obeying inverse option)
onPrevMovenullPrevious image is loaded (obeying inverse option)
onNextFramenullNext image is loaded following the order in the image source (indifferent to inverse option)
onPrevFramenullPrevious image is loaded according to the order in the image source (indifferent to inverse option)
onDragStartnullImage rotation sequence (dragging) starts
onDragEndnullImage rotation sequence (dragging) ends
onFrameChangenumberNext image is loaded, sending out the current image index
onSKUDataLoadedobjectreturns sku data object, helpful in rendering other ui
OnThumbnailLoadedstring (uri)get the current sku thumbnail, helpful in rendering other ui
onLoadChangeload_success, percentageload_success: get whether all images have been loaded, percentage: current load percentage

Ref Functions

Function NameParams TypeDescription
prev()nulltrigger prev move
next()nulltrigger next move
gotoFrame(frame)numberframe number to jump when clicked

License

© dybo-io

0.0.26

3 years ago

0.0.27

3 years ago

0.0.25

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.22

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.15

3 years ago

0.0.9

3 years ago

0.0.16

3 years ago

0.0.8

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago