forked from deephaven/deephaven-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
|
||
__all__ = [ | ||
"action_button", | ||
"button", | ||
"checkbox", | ||
"component", | ||
"content", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { useCallback } from 'react'; | ||
import { | ||
Button as SpectrumButton, | ||
SpectrumButtonProps, | ||
} from '@adobe/react-spectrum'; | ||
|
||
function Button(props: SpectrumButtonProps & { onPress?: () => void }) { | ||
const { onPress: propOnPress, ...otherProps } = props; | ||
|
||
const onPress = useCallback( | ||
e => { | ||
// The PressEvent from React Spectrum is not serializable (contains circular references). We're just dropping the event here but we should probably convert it. | ||
// TODO(#76): Need to serialize PressEvent and send with the callback instead of just dropping it. | ||
propOnPress?.(); | ||
}, | ||
[propOnPress] | ||
); | ||
|
||
return ( | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
<SpectrumButton onPress={onPress} {...otherProps} /> | ||
); | ||
} | ||
|
||
Button.displayName = 'Button'; | ||
|
||
export default Button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters