Skip to content

Commit 3fc3aaa

Browse files
committed
OpenConceptLab/ocl_issues#2190 | draggable concept dialog
1 parent 982b005 commit 3fc3aaa

5 files changed

Lines changed: 40 additions & 2 deletions

File tree

package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"moment": "^2.30.1",
2222
"react": "^18.3.1",
2323
"react-dom": "^18.3.1",
24+
"react-draggable": "^4.5.0",
2425
"react-ga4": "^2.1.0",
2526
"react-hotjar": "^5.5.0",
2627
"react-i18next": "^12.1.5",
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import Draggable from 'react-draggable';
3+
import Paper from '@mui/material/Paper';
4+
5+
6+
const DraggablePaperComponent = props => {
7+
const nodeRef = React.useRef(null);
8+
return (
9+
<Draggable
10+
nodeRef={nodeRef}
11+
handle="#draggable-dialog-title"
12+
cancel={'[class*="MuiDialogContent-root"]'}
13+
>
14+
<Paper {...props} ref={nodeRef} />
15+
</Draggable>
16+
);
17+
}
18+
19+
export default DraggablePaperComponent

src/components/concepts/ConceptHeader.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const ConceptHeader = ({concept, repo, onClose, repoURL, onEdit, nested, loading
3333
}
3434

3535
return (
36-
<React.Fragment>
36+
<div className='col-xs-12 padding-0' style={{cursor: 'move'}} id='draggable-dialog-title'>
3737
<div className='col-xs-12 padding-0' style={{display: 'flex', alignItems: 'center', justifyContent: 'space-between'}}>
3838
<span style={{width: 'calc(100% - 40px)'}}>
3939
{
@@ -89,7 +89,7 @@ const ConceptHeader = ({concept, repo, onClose, repoURL, onEdit, nested, loading
8989
</span>
9090
</div>
9191
}
92-
</React.Fragment>
92+
</div>
9393
)
9494
}
9595

src/components/map-projects/MapProject.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ import SearchHighlightsDialog from '../search/SearchHighlightsDialog'
7474
import ConceptHome from '../concepts/ConceptHome'
7575
import RepoSearchAutocomplete from '../repos/RepoSearchAutocomplete'
7676
import RepoVersionSearchAutocomplete from '../repos/RepoVersionSearchAutocomplete'
77+
import DraggablePaperComponent from '../common/DraggablePaperComponent'
7778
import { HEADERS, SEMANTIC_SEARCH_HEADERS, ROW_STATES, VIEWS, DECISION_TABS } from './constants'
7879
import MapProjectDeleteConfirmDialog from './MapProjectDeleteConfirmDialog';
7980
import ConfigurationForm from './ConfigurationForm'
@@ -1520,6 +1521,8 @@ const MapProject = () => {
15201521
{
15211522
showItem?.id &&
15221523
<Dialog
1524+
PaperComponent={DraggablePaperComponent}
1525+
aria-labelledby="draggable-dialog-title"
15231526
disableEscapeKeyDown
15241527
open
15251528
onClose={() => setShowItem(false)}

0 commit comments

Comments
 (0)