-
Notifications
You must be signed in to change notification settings - Fork 30
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(components): improve positioning of DataList actions [JOB-99926] #1915
Changes from 17 commits
7bedf1e
f155370
f2d66e3
65bcba2
a1d95a3
1dd63a5
51be5c7
6997e47
e3f6ddd
1fe979b
a124cd4
17d487e
842e037
6c8349c
872d90a
b610fba
6945243
286f1c2
31f6dc7
7794a79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import React, { Children, ReactElement, isValidElement } from "react"; | ||
import { Tooltip } from "@jobber/components/Tooltip"; | ||
import { Button } from "@jobber/components/Button"; | ||
import { DataListOverflowFade } from "../DataListOverflowFade"; | ||
import { | ||
DataListActionProps, | ||
DataListActionsProps, | ||
|
@@ -25,7 +24,7 @@ export function DataListActions<T extends DataListObject>({ | |
childrenArray.splice(0, exposedActions.length); | ||
|
||
return ( | ||
<DataListOverflowFade> | ||
<span data-testid="ATL-DataListActions"> | ||
{exposedActions.map(({ props }) => { | ||
if (props.visible && !props.visible(activeItem)) return null; | ||
if (!props.icon) return null; | ||
|
@@ -54,14 +53,14 @@ export function DataListActions<T extends DataListObject>({ | |
(props.onClick as () => void)?.(); | ||
} | ||
}} | ||
type="secondary" | ||
type="tertiary" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tertiary button in the "individual" actions |
||
variation="subtle" | ||
/> | ||
</Tooltip> | ||
); | ||
})} | ||
|
||
<DataListItemActionsOverflow actions={childrenArray} /> | ||
</DataListOverflowFade> | ||
</span> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
.menu { | ||
display: flex; | ||
position: absolute; | ||
top: calc(var(--space-small) * -1); | ||
top: -26px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this number is relatively magic There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🪄 I trust in your magic, Chris. |
||
right: 0; | ||
z-index: var(--elevation-menu); | ||
box-shadow: var(--shadow-base); | ||
padding: var(--space-smaller); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since padding is now 0, no need to declare it |
||
border: var(--border-base) solid var(--color-border); | ||
border-radius: var(--radius-base); | ||
background-color: var(--color-surface); | ||
gap: var(--space-smaller); | ||
gap: var(--space-smallest); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeps a pinch of space between the actions so the focus states don't encroach too heavily on sibling buttons |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,8 @@ export function DataListItemActions<T extends DataListObject>( | |
} | ||
|
||
const variants: Variants = { | ||
hidden: { opacity: 0, y: 10 }, | ||
visible: { opacity: 1, y: 0 }, | ||
hidden: { opacity: 0, y: 0 }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adjusts the animation to map better to the new position |
||
visible: { opacity: 1, y: 4 }, | ||
}; | ||
|
||
interface InternalDataListItemActionsProps<T extends DataListObject> { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ export function DataListItemActionsOverflow<T extends DataListObject>({ | |
<Button | ||
icon="more" | ||
ariaLabel="More actions" | ||
type="secondary" | ||
type="tertiary" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tertiary button in the "more" actions unclear to me at this point why this action is different from the DataList actions but here we are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a good separation of concerns. I think we could also pretty easily extract & simplify |
||
variation="subtle" | ||
onClick={handleMoreClick} | ||
/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
.fadeContainer { | ||
--overflow-fade--offset: var(--space-smaller); | ||
--overflow-fade--negative-offset: calc(var(--overflow-fade--offset) * -1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These values are now the same and can be applied accordingly with one variable I considered removing the margin and padding declarations, but since the positions of the gradients are coupled to those values, felt worth keeping them in sync |
||
--overflow-fade--offset: 0; | ||
|
||
align-self: center; | ||
position: relative; | ||
|
@@ -20,7 +19,7 @@ | |
} | ||
|
||
.overflowGrid { | ||
margin: var(--overflow-fade--negative-offset); | ||
margin: var(--overflow-fade--offset); | ||
padding: var(--overflow-fade--offset); | ||
overflow-x: auto; | ||
overflow-y: visible; | ||
|
@@ -46,10 +45,10 @@ | |
} | ||
|
||
.overflowLeft::before { | ||
left: var(--overflow-fade--negative-offset); | ||
left: var(--overflow-fade--offset); | ||
} | ||
|
||
.overflowRight::after { | ||
--data-list-overflow-shadow-angle: to left; | ||
right: var(--overflow-fade--negative-offset); | ||
right: var(--overflow-fade--offset); | ||
} |
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.
DataListOverFlowFade came with a testid that was being referenced in BatchActions test - this preserves the test
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.
hmmm, we have a file,
packages/components/src/DataList/components/DataListBulkActions/DataListBulkActions.const.ts
that holdsWhich actually isn't being used anywhere. We should use
BULK_ACTIONS_CONTAINER_TEST_ID
instead, but not in this file.We should:
DataListActions.tsx
, it just becomes empty fragmentDataListBulkActions.tsx
would now have the bulk actions test id:DataListBulkActions.test.tsx
you put that testid in there instead:This way, we're using an unused testid, which is more correct to what we're testing. Let me know if I'm not communicating this well enough we can hop on a call