GithubHelp home page GithubHelp logo

nerdyman / react-image-turntable Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 1.0 526 KB

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

TypeScript 95.81% HTML 1.82% CSS 1.69% Shell 0.68%
360 component hacktoberfest image react rotator slider turntable

react-image-turntable's Introduction

๐Ÿ‘‹ Heyo, I'm Ricky

Full-stack developer and purveyor of niche React libraries.

dev.to account CodeSandbox account Stack Overflow account View my resume

react-image-turntable's People

Contributors

aleskiweb avatar nerdyman avatar webmarkyn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

webmarkyn

react-image-turntable's Issues

Build module in ESM Format

  • Bundle module in ESM format (no CJS - all supported browsers also support ESM)
  • Add local demo of library to repo
  • Publish alpha version of v3
  • Add Codesandbox link using example folder in repo

Add hook to control all state from parent

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.

Example usage

import { ReactImageTurntable, useReactImageTurntable } from 'react-image-turntable'; 

const Example = () => {
  const turntableProps = useReactImageTurntable({ autoRotate: { interval: 200 } });

  return <ReactImageTurntable {...turntableProps} />
}

Add Basic Accessibility Features

  • Element should be focusable and support keyboard navigation
  • Each image should still append the current index to its alt tag
  • Determine if there's an accessible (screen reader friendly) way to render the turntable

Npm package is corrupted

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.

NPM VERSION
Screenshot 2023-12-13 at 18 50 53

PNPM OUTPUT
Screenshot 2023-12-13 at 18 51 19

Generate Royalty-free Images to Demonstrate Usage

Type information can not be found

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 tests

Replace existing Jest tests with E2E tests using Playwright.

  • Replace Jest with E2E tests
  • Generate coverage and upload to Code Climate

Forward props and simplify logic

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.

  • Spread all props
  • Simplify inner hook logic to use event listeners with minimal state updates

Add `autorotate.disableOnInteraction`

Add autorotate.disableOnInteraction property which defaults to true to automatically set autorotate.disabled: true when slider is interacted with using the keyboard or pointer.

This should override the maxStepCount prop in #27

Needs #24

Expose `movementSensitivity` as a prop

The movement sensitivity is currently hardcoded to 20, however it may be useful for this to be configured by the user.

  • Expose movementSensitivity as a prop and pass it to the hook
  • Default movementSensitivity value to 20

Cleanly add and remove pointer events

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.

  • Add ability to drag outside of container with mouse down and continue dragging
  • Disconnect drag event when pointer up fires outside of container

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.