-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Restrict using Image Slider to landscape images #1743
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good to learn about this TS option.
Co-authored-by: Vincent Smedinga <[email protected]>
@@ -17,6 +17,8 @@ The images do not slide automatically. | |||
- Use this for a series of images that belong together. | |||
- Provide at least 2 images and at most 5. | |||
- Feature the most essential image first. | |||
- All images must have the same aspect ratio. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want specify this as a guideline? This isn't currently the case, right? I kind of like that you can use different aspect ratio's in the same slider
/** Specify the aspect ratio to use for the images. */ | ||
aspectRatio: Ratio | ||
export type ImageSliderImageProps = Omit<ImageProps, 'aspectRatio'> & { | ||
/** The aspect ratio to use for the images. Options: `tall`, `square`, `wide`, and `x-wide`. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to specify the options in text here? The type will already show you the possible options, no?
aspectRatio: Ratio | ||
export type ImageSliderImageProps = Omit<ImageProps, 'aspectRatio'> & { | ||
/** The aspect ratio to use for the images. Options: `tall`, `square`, `wide`, and `x-wide`. */ | ||
aspectRatio: Pick<Ratio, 'tall' | 'square' | 'wide' | 'x-wide'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have to use Extract here:
aspectRatio: Pick<Ratio, 'tall' | 'square' | 'wide' | 'x-wide'> | |
aspectRatio: Extract<Ratio, 'tall' | 'square' | 'wide' | 'x-wide'> |
Describe the pull request
The images in a image slider should only be able to use aspect-ratio 1:1, 4:3 and 16:9. landscape is nog an option.
What
The exclusion of type values
Why
To prevent the image slider from becomming to tall to scroll on small screens.
How
(How were these changes implemented? Provide a brief overview of the approach taken and any key considerations.)
Checklist
Before submitting your pull request, please ensure you have done the following. Check each checkmark if you have done so or if it wasn't necessary:
Additional notes