-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
ref(components): extracted a DragReorderButton component #110982
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
Changes from all commits
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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import {Button, type ButtonProps} from '@sentry/scraps/button'; | ||
|
|
||
| import {IconGrabbable} from 'sentry/icons'; | ||
| import {t} from 'sentry/locale'; | ||
| import type {IconSize} from 'sentry/utils/theme'; | ||
|
|
||
| type DragReorderButtonProps = Omit<ButtonProps, 'children'> & { | ||
| iconSize?: IconSize; | ||
| }; | ||
|
|
||
| export function DragReorderButton({ | ||
| size = 'zero', | ||
| iconSize = 'xs', | ||
| ref, | ||
| ...props | ||
| }: DragReorderButtonProps) { | ||
| return ( | ||
| <Button | ||
| aria-label={t('Drag to reorder')} | ||
| priority="transparent" | ||
| size={size} | ||
| style={{cursor: 'grab'}} | ||
| icon={<IconGrabbable size={iconSize} />} | ||
| ref={ref} | ||
| {...props} | ||
| /> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,8 @@ import styled from '@emotion/styled'; | |
|
|
||
| import {Button} from '@sentry/scraps/button'; | ||
|
|
||
| import {IconDelete, IconGrabbable} from 'sentry/icons'; | ||
| import {DragReorderButton} from 'sentry/components/dnd/dragReorderButton'; | ||
| import {IconDelete} from 'sentry/icons'; | ||
| import {t} from 'sentry/locale'; | ||
| import type {SelectValue} from 'sentry/types/core'; | ||
| import { | ||
|
|
@@ -91,12 +92,7 @@ export function VisualizeGhostField({ | |
| return ( | ||
| <Ghost> | ||
| <FieldRow> | ||
| <DragAndReorderButton | ||
| aria-label={t('Drag to reorder')} | ||
| icon={<IconGrabbable size="xs" />} | ||
| size="zero" | ||
| priority="transparent" | ||
| /> | ||
| <StyledDragReorderButton /> | ||
|
Contributor
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. Inline cursor style overrides ghost's grabbing cursorMedium Severity The Additional Locations (1)
Member
Author
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. [Question] 🤔 I'm not sure which way is better... the custom ghost-y one before, or aligning to the new way?
Member
Author
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.
Member
Author
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'm talking with product about filing an issue)
Member
Author
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. |
||
| <FieldBar> | ||
| {draggingField?.kind === FieldValueKind.EQUATION ? ( | ||
| <StyledArithmeticInput | ||
|
|
@@ -237,6 +233,6 @@ const Ghost = styled('div')` | |
| } | ||
| `; | ||
|
|
||
| const DragAndReorderButton = styled(Button)` | ||
| const StyledDragReorderButton = styled(DragReorderButton)` | ||
| height: ${p => p.theme.form.md.height}; | ||
| `; | ||



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.
While we're here 😄