Comments (7)
Just a few quick thoughts as a brain dump on what I think it might take to make this happen:
- Instead of passing just an array of image links down to the slider as props, we might want to actually create an array of objects instead. This way the developer could customize every single slide to suit there needs.
Here is a very naive example of what I was thinking:
const slides = [
{
// Breakpoints at which to display a different sized image.
sizes: [480, 768, 1000],
// Images could be absolute, relative, or complete URLs.
content: ['https://images.somecoolstartup.com/mountain-view.jpg', './public/static/images/summer.jpg'],
// Allow some separation between the slides if displaying more than 1 per.
spacing: { amount: 2, unit: 'em' }
},
{
sizes: [768, 1024],
content: ['/var/www/html/static/img/night-sky.jpg']
}
]
from react-hooks-image-slider.
Another option would be to have the browser load images that it needs from Cloudinary. I'm working on a project doing this with gatsby. It's way better than having the dev make a ton of different image sizes.
from react-hooks-image-slider.
I haven't used it before, but if you upload images, you can tell their app to generate them for you, or does it automatically re-create the images in a few default sizes?
Either way, all the developer would need to do in that case is just paste in the url to each image hosted on their cloudinary account.
from react-hooks-image-slider.
IIRC, you set up the sizes you want for the srcset in the gatsby config and then all those sizes are generated by Cloudinary automatically. Then the browser gets what it needs from the srcset which you get from the graphql query.
This way you only list the sizes once in the config for all your screen sizes.
Well it's not in the config, lol. I'm looking...I think the sizes may just autogenerate...
Yeah, I'll go with the above that Cloudinary autogenerates the srcset and I pick the max size in my graphql query.
Here's my repo:
https://github.com/erichodges/cloudinary-test
I'm still in process on that repo. I want to integrate your slider along with some other stuff.
Here's the video where I learned about using Cloudinary with gatsby:
https://www.youtube.com/watch?v=rDlokHuYwq4
from react-hooks-image-slider.
Okay cool. I'm thinking about refactoring the master branch of this to actually become a library that can be used on NPM. I'll check out your repo, and perhaps we could hack on this feature in branch I'll create called dynamic-images
.
We can use your cloudinary account to test things out if you want.
from react-hooks-image-slider.
Actually, it should prob be called multiple-slides
since that's what the initial problem was.
from react-hooks-image-slider.
Cool, yeah that sounds great. We will need a way to chat that is encrypted. Maybe on discord...
from react-hooks-image-slider.
Related Issues (12)
- Requesting for AutoPlay feature HOT 3
- Is it possible to change slide transition to any animation on previous and next.
- Multiple sliders on the same page HOT 5
- Overlaping component
- Should be able to click on radio button to change to corresponding image. HOT 1
- Responsive translate HOT 3
- Images end up not appearing after one cycle on mobile (iOS and Chrome) HOT 3
- autoplay
- Reset the Interval HOT 2
- Problem with node-sass, old version has been removed. Gotta update to latest (at least 4.12.0);)
- Stop autoplay HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-hooks-image-slider.