mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-24 00:33:50 +00:00
Co-authored-by: Chris Collins <chriscollins3456@gmail.com> Co-authored-by: Victor Tarasevich <v.tarasevich@blitz-brain.com> Co-authored-by: Andrew Sikowitz <andrew.sikowitz@acryl.io>
31 lines
668 B
TypeScript
31 lines
668 B
TypeScript
import React from 'react';
|
|
import styled from 'styled-components';
|
|
|
|
const StyledWrapper = styled.span`
|
|
width: max-content;
|
|
display: flex;
|
|
`;
|
|
|
|
interface Props {
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
const StopPropagationWrapper = ({ children }: Props) => {
|
|
return (
|
|
<StyledWrapper
|
|
onClick={(e) => e.stopPropagation()}
|
|
role="button"
|
|
tabIndex={0}
|
|
onKeyDown={(e) => {
|
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
e.stopPropagation();
|
|
}
|
|
}}
|
|
>
|
|
{children}
|
|
</StyledWrapper>
|
|
);
|
|
};
|
|
|
|
export default StopPropagationWrapper;
|