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

fix: Tabs overflow handling #50

Merged
merged 8 commits into from
Aug 14, 2024
Merged

Conversation

ieedan
Copy link
Contributor

@ieedan ieedan commented Aug 13, 2024

Currently the tabs component uses flex-wrap so the tabs stack on overflow.

  • Updated the tabs component to properly handle horizontal scrolling
  • Added no-scrollbar class to hide the scrollbar
  • Added preBlur and postBlur to show the user that there is more content to be scrolled.
  • Added example with overflow (Vercel doesn't have this so I can axe it after review if necessary)

Copy link

github-actions bot commented Aug 13, 2024

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
geist ✅ Ready (View Log) Visit Preview ca67518

Copy link
Owner

@shyakadavis shyakadavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, @ieedan

Always appreciate your help. 🙂 Thank you very much for thoughtful polishes. Left 2 suggestions, please let me know what you think.

Also, liked your shadcn-svelte phone-input. If you'd like, please consider adding it to the list here: https://github.com/shyakadavis/awesome-shadcn-svelte 🙂

src/lib/components/ui/tabs/tabs-list.svelte Outdated Show resolved Hide resolved
src/lib/components/ui/tabs/tabs-list.svelte Outdated Show resolved Hide resolved
@ieedan
Copy link
Contributor Author

ieedan commented Aug 13, 2024

Thanks I should have some updates in an hour or two once I get back from lunch

@ieedan
Copy link
Contributor Author

ieedan commented Aug 13, 2024

I tried a few of the solutions you sent I couldn't find anything much better than what I already have. I darkened up the shadow though so now it is more visible.

  • Added transitions to in and out of blurs
  • Resize handler
  • blur_overflow Prop to allow for turning off the blurring

To make it work I have to wrap it in a <div class="relative"> which isn't very nice.

Let me know what you think!

@shyakadavis
Copy link
Owner

shyakadavis commented Aug 14, 2024

Hey, @ieedan

You're right. No easy solution would have worked without adding an unnecessary div, so instead of foregoing on the indicate overflow bit, let's use a mask instead. I know adding a package for just a mask is overkill, but I suspect this will come in handy in other places/future, and for what it's worth, the plugin is only a few lines-ish.

https://github.com/pyncz/tailwind-mask-image

Before with blur:

Screenshot 2024-08-14 at 14 28 48

After with mask:

Screenshot 2024-08-14 at 15 12 08

@ieedan
Copy link
Contributor Author

ieedan commented Aug 14, 2024

Yeah that looks much better

Copy link
Owner

@shyakadavis shyakadavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As always, grateful for the help, @ieedan

Thank you.

@shyakadavis shyakadavis merged commit dce074a into shyakadavis:main Aug 14, 2024
4 checks passed
@ieedan
Copy link
Contributor Author

ieedan commented Aug 14, 2024

image

I think we need 2 masks for situations like this

@shyakadavis
Copy link
Owner

Ah, I see. Sorry for missing this.

Mind opening a follow-up P.R please? I was working on the Table component, and might get to it late.

@ieedan
Copy link
Contributor Author

ieedan commented Aug 14, 2024

Yeah np.

I think this is too much?

image

@shyakadavis
Copy link
Owner

Might be indeed. 😅 Even if we were to reduce the mask-point-to-[{percetage}] it could still be too much. 🤷

@ieedan
Copy link
Contributor Author

ieedan commented Aug 14, 2024

I am gonna play with it a bit more hopefully I can get it to match up with what we have already

@ieedan
Copy link
Contributor Author

ieedan commented Aug 14, 2024

This looks much closer
Both:
image

Post:
image

@ieedan
Copy link
Contributor Author

ieedan commented Aug 14, 2024

My best idea at this point is to use a Pseudo-element to do this.

In a perfect world I could just overlay a ::before element with its own mask on top but this has not been very easy.

I am having a lot of trouble doing this right now and even if I can get the classes to apply we would still need to apply it to a parent container of the tabs because it moves during scroll.

I think I'll have to circle back at another time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants