-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(tabs): Add new tab variant for draggable tabs #74867
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #74867 +/- ##
==========================================
- Coverage 78.16% 78.11% -0.05%
==========================================
Files 6733 6740 +7
Lines 300307 300637 +330
Branches 51649 51726 +77
==========================================
+ Hits 234729 234842 +113
- Misses 59255 59501 +246
+ Partials 6323 6294 -29
|
malwilley
left a comment
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.
Could you add a section to the .stories file so we can see what the new variant looks like?
52c1102 to
285009f
Compare
malwilley
left a comment
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.
@malwilley |
e27e901 to
a39e103
Compare
a39e103 to
932362f
Compare
932362f to
f59efbc
Compare
| InteractionStateLayer.defaultProps = { | ||
| hasSelectedBackground: true, | ||
| }; |
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.
This is how default props have to be defined apparently 🫠 (setting hasSelectedBackground=true in the destructed props does not work)
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.
Oh I see, because it's a styled component I guess
| InteractionStateLayer.defaultProps = { | ||
| hasSelectedBackground: true, | ||
| }; |
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.
Oh I see, because it's a styled component I guess
static/app/components/tabs/tab.tsx
Outdated
| * Additional props to be merged with `tabProps`. This is used | ||
| * by <DraggableTab> to pass in props used for drag-and-drop functionality. | ||
| */ | ||
| additionalProps?: React.HTMLAttributes<HTMLElement>; |
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.
Can we remove additionalProps by merging these in DraggableTab instead?
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 remember trying to do that but I vaguely remember there being an issue that forced me to pass in props here. I think a good temporary solution would be to remove additionalProps for now and revisit that problem as part of merging in the changes I made a couple weeks ago.
malwilley
left a comment
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.
Looks good!
This PR makes non-visible changes to the tabs component in anticipation of future changes being made for custom views. Specifically, it separates the `<Tab/>` and `<BaseTab/>` variants and adds a new `variant` prop that controls which group of styles are being applied to the baseTab component. It also reorganizes the component structure of the `<TabList>` to allow for the overflow menu to be reusable, since it will be used in the future draggable tabs component.
This PR creates the `<DraggableTabs/>` component along with many supporting components. It utilizes the new tab variant [recently introduced](#74867), and adds support for reordering them via dragging (implemented w/ Framer motion). This PR contains a subset of changes from a previous [PR](#73543) that contained a lot of new changes to the draggable tabs component, and it will be the first in a series of PRs that break up that PR into smaller chunks. This PR _should_ be the largest of them all, since it creates all of the draggable tabs components. I have tried to pare the old PR down to _only_ contain the changes necessary to get the draggable tabs to be actually draggable (using Framer motion), but please feel free to comment on anything that looks like it may be an artifact of these changes. Known issues in this current implementation that will be fixed in subsequent PRs: - There are no tests for this component - Overflow tabs interact with the tab dividers very weirdly - Tab names wrap very weirdly https://github.com/user-attachments/assets/329fe197-b6af-47af-8faa-4d34ef65181f



This PR makes non-visible changes to the tabs component in anticipation of future changes being made for custom views. Specifically, it separates the
<Tab/>and<BaseTab/>variants and adds a newvariantprop that controls which group of styles are being applied to the baseTab component.It also reorganizes the component structure of the
<TabList>to allow for the overflow menu to be reusable, since it will be used in the future draggable tabs component.