-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
1 parent
9d776d3
commit 10136b8
Showing
2 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
packages/unigraph-dev-explorer/src/examples/notes/DragHandle.tsx
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,40 @@ | ||
/* eslint-disable react/require-default-props */ | ||
import { styled } from '@mui/styles'; | ||
import React from 'react'; | ||
|
||
const DragHandleContainer = styled('div')({ | ||
width: '1rem', | ||
height: '1rem', | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
cursor: 'pointer', | ||
borderRadius: '0.25rem', | ||
transition: 'background 30ms ease-in', | ||
'&:hover': { | ||
background: 'rgba(0, 0, 0, 0.1)', | ||
}, | ||
'&:active': { | ||
background: 'rgba(0, 0, 0, 0.2)', | ||
}, | ||
}); | ||
|
||
interface Props { | ||
style?: React.CSSProperties; | ||
onContextMenu?: (event: React.MouseEvent) => void; | ||
} | ||
|
||
export const DragHandle = React.forwardRef<HTMLDivElement, Props>(({ style, onContextMenu }, ref) => { | ||
return ( | ||
<DragHandleContainer ref={ref} style={style} onContextMenu={onContextMenu}> | ||
<svg width="100%" height="100%" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> | ||
<circle cx="9" cy="7" r="1.5" /> | ||
<circle cx="9" cy="12" r="1.5" /> | ||
<circle cx="9" cy="17" r="1.5" /> | ||
<circle cx="15" cy="7" r="1.5" /> | ||
<circle cx="15" cy="12" r="1.5" /> | ||
<circle cx="15" cy="17" r="1.5" /> | ||
</svg> | ||
</DragHandleContainer> | ||
); | ||
}); |
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