Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

dlnr
Copy link
Contributor

@dlnr dlnr commented Nov 5, 2024

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:

  • Add or update unit tests
  • Add or update documentation
  • Add or update stories
  • Add or update exports in index.* files
  • Start the PR title with a Conventional Commit prefix, as explained here.

Additional notes

  • Provide links to any related issues or discussions.
  • Add a link to the specific story in the feature branch deploy.
  • Mention any areas where additional review or feedback is needed.

@dlnr dlnr requested a review from VincentSmedinga November 5, 2024 13:46
@RubenSibon RubenSibon self-requested a review November 5, 2024 14:30
RubenSibon
RubenSibon previously approved these changes Nov 5, 2024
Copy link
Contributor

@RubenSibon RubenSibon left a 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.

@VincentSmedinga VincentSmedinga changed the title fix: Excluding ratios feat: Restrict using Image Slider to landscape images Nov 5, 2024
@github-actions github-actions bot temporarily deployed to demo-image-slider-aspect-ratios November 5, 2024 17:48 Destroyed
@github-actions github-actions bot temporarily deployed to demo-image-slider-aspect-ratios November 5, 2024 19:28 Destroyed
@@ -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.
Copy link
Contributor

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`. */
Copy link
Contributor

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'>
Copy link
Contributor

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:

Suggested change
aspectRatio: Pick<Ratio, 'tall' | 'square' | 'wide' | 'x-wide'>
aspectRatio: Extract<Ratio, 'tall' | 'square' | 'wide' | 'x-wide'>

@dlnr dlnr closed this Nov 8, 2024
@VincentSmedinga VincentSmedinga deleted the hotfix/image-slider-aspect-ratios branch November 8, 2024 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants