nerdyman / react-image-turntable Goto Github PK
View Code? Open in Web Editor NEWDisplay a set of images as a draggable 360 degree turntable.
Home Page: https://githubbox.com/nerdyman/react-image-turntable/tree/main/example
License: MIT License
Display a set of images as a draggable 360 degree turntable.
Home Page: https://githubbox.com/nerdyman/react-image-turntable/tree/main/example
License: MIT License
Add useReactImageTurntable
hook to expose internal functions to the parent component. This will allow the parent component to hook into the internal logic of the component, simplifying state management.
Props should be passed to the hook instead of directly to the component.
import { ReactImageTurntable, useReactImageTurntable } from 'react-image-turntable';
const Example = () => {
const turntableProps = useReactImageTurntable({ autoRotate: { interval: 200 } });
return <ReactImageTurntable {...turntableProps} />
}
Hello @nerdyman. I was trying to install the new 3.1.0
version today and got the following error when trying to run the project EvalError: Code generation from strings disallowed for this context
. dist/index.mjs
file looks strange and contains strings with absolute paths like
var e="/Users/me/Documents/projects/nerdyman/react-image-turntable/src/hooks.ts"
When I run pnpm build
I get completely different output that's not even close to the index.mjs
file that I get when installing a package from npm
.
Demo currently uses proprietary rendered images to showcase usage.
Some potential models:
static
folder to repo with rendered images and source filesThe first image inside of the images passed to the turntable always displays for me on 3.0.0
When building the package the declaration file dist/index.d.mts
is created. However package.json
states "typings": "dist/index.d.ts"
(code). Because of this mismatch (.mts
vs .ts
) TypeScript fails to find the type information and gives the error Cannot find module 'react-image-turntable' or its corresponding type declarations
.
Add np
to handle publishing of npm module and GitHub releases.
Replace existing Jest tests with E2E tests using Playwright.
Current implementation only allows images
prop. We should allow ref forwarding and spreading of any props supported by a div
element to make it easy to customise and extend.
The local example repo increments twice when dragging or using keyboard nav but the production build is fine.
Probably related to strict mode changes in React 18 https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html#updates-to-strict-mode
Pointer movement is buggy and sometimes doesn't fire at all on mobile/touch devices.
np doesn't work well with pnpm, use release it instead.
Add autoRotate.counterClockwise
to control which way the turntable autorotates. Defaults to false or undefined.
The movement sensitivity is currently hardcoded to 20
, however it may be useful for this to be configured by the user.
movementSensitivity
as a prop and pass it to the hookmovementSensitivity
value to 20
Mousing down within the container and moving cursor outside of the container stops dragging, mousing over the container after the pointer up event has outside of the container causes the turntable to follow the mouse even though the mouse is no longer down.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.