0.0.27 • Published 3 years ago
@dybo-io/dybo-sixty-1 v0.0.27
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 Name | Prop Type | Default Value | Required? | Description | ||||||
---|---|---|---|---|---|---|---|---|---|---|
skuID | string | null | yes | SKU ID on dybo's server | ||||||
dyboAPIKey | string | null | yes | API Key for dybo server | ||||||
currentFeatures | object | null | yes | current Features to be requested from the server - exa: {feature1 : "option1", feature2 : "option2", ...} | ||||||
className | string | undefined | no | Add class name for the component | ||||||
style | object | undefined | no | Add style for the component | ||||||
hintOnStartUp | boolean | false | no | Enable/disable hint on start up | ||||||
hintText | string | undefined | no | Enable/disable hint text | ||||||
touch | boolean | true | no | Enable/disable touch support | ||||||
mousewheel | boolean | false | no | Enable/disable mousewheel support | ||||||
inverse | boolean | false | no | Swap image rotation direction. Affects mouse drag, mousewheel and touch | ||||||
dragInterval | number | 1 | no | Adjust rotation speed for mouse drag events | ||||||
touchDragInterval | number | 2 | no | Adjust rotation speed for touch events | ||||||
mouseleaveDetect | boolean | false | no | If true, active drag event will stop whenever mouse cursor leaves DyboSixty container | number | 3 | no | maximum zoom value | ||
renderHint | func | undefined | no | render a customized hint message | ||||||
jumpDelay | number | 70 | no | interval to switch between frames using goToFrame prop event | ||||||
zoomFactor | number | 2 | no | zoom intensity when clicked |
Prop Events
Prop Name | Params Type | Description |
---|---|---|
onHintHide | null | Hint is hidden |
onAutoplayStart | null | Autoplay is started |
onAutoplayStop | null | Autoplay is stopped |
onNextMove | null | Next image is loaded (obeying inverse option) |
onPrevMove | null | Previous image is loaded (obeying inverse option) |
onNextFrame | null | Next image is loaded following the order in the image source (indifferent to inverse option) |
onPrevFrame | null | Previous image is loaded according to the order in the image source (indifferent to inverse option) |
onDragStart | null | Image rotation sequence (dragging) starts |
onDragEnd | null | Image rotation sequence (dragging) ends |
onFrameChange | number | Next image is loaded, sending out the current image index |
onSKUDataLoaded | object | returns sku data object, helpful in rendering other ui |
OnThumbnailLoaded | string (uri) | get the current sku thumbnail, helpful in rendering other ui |
onLoadChange | load_success, percentage | load_success: get whether all images have been loaded, percentage: current load percentage |
Ref Functions
Function Name | Params Type | Description |
---|---|---|
prev() | null | trigger prev move |
next() | null | trigger next move |
gotoFrame(frame) | number | frame 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