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

Simplify SegmentedSwitch implementation #576

Merged
merged 5 commits into from
May 30, 2023
Merged

Conversation

sjavora
Copy link
Member

@sjavora sjavora commented May 26, 2023

No changes in functionality, just code simplification. No more custom builder, so there is no longer a two-view limit, but everything else should stay the same - and it seems this will work with a ForEach as well, so this is a good preparation for Tabs.

Closes #575.

@sjavora sjavora requested a review from PavelHolec May 26, 2023 22:50
@sjavora sjavora requested a review from a team as a code owner May 26, 2023 22:50
@sjavora sjavora self-assigned this May 26, 2023
@sjavora sjavora force-pushed the 575-simplify-segmented-switch branch from bea62a4 to 0470c04 Compare May 26, 2023 22:52
Copy link
Collaborator

@PavelHolec PavelHolec left a comment

Choose a reason for hiding this comment

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

👍

Sources/Orbit/Components/SegmentedSwitch.swift Outdated Show resolved Hide resolved
Sources/Orbit/Components/SegmentedSwitch.swift Outdated Show resolved Hide resolved
Sources/Orbit/Components/SegmentedSwitch.swift Outdated Show resolved Hide resolved
Sources/Orbit/Components/SegmentedSwitch.swift Outdated Show resolved Hide resolved
@sjavora sjavora changed the title Simplifiy SegmentedSwitch implementation Simplify SegmentedSwitch implementation May 29, 2023
@sjavora sjavora requested a review from PavelHolec May 29, 2023 13:40
@sjavora sjavora force-pushed the 575-simplify-segmented-switch branch from 0470c04 to 275ce65 Compare May 29, 2023 13:40
@sjavora
Copy link
Member Author

sjavora commented May 29, 2023

@PavelHolec updated everything, including the button background highlight - I just used what looked right to me, so this will probably need to be tweaked. I think we'll want to use the same thing for Tabs, so I extracted the style to a separate file.

@sjavora sjavora force-pushed the 575-simplify-segmented-switch branch from 080dcda to 0427080 Compare May 29, 2023 22:23
@sjavora
Copy link
Member Author

sjavora commented May 29, 2023

@PavelHolec please recheck - probably the whole thing. Buttons are now responsible for drawing the selected segment, so the custom style can shrink the backgournd kind of like the official component. I tried to update the fade/highlight on the unselected segments, but of course we're limited here by the fact that the buttons don't actually contain the content, but are drawn under them, so no fade of the titles and no shrinking of the titles, either.

Still, I think this is now pretty damn good, considering how much time (way more than I'd like) I spent on it. See video for what the interactions look like now.

Ideal size is also supported.

Screen.Recording.2023-05-30.at.0.20.59.mov

@sjavora sjavora merged commit 8a9c328 into main May 30, 2023
@sjavora sjavora deleted the 575-simplify-segmented-switch branch May 30, 2023 09:08
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.

Simplify SegmentedSwitch implementation
2 participants