forked from openedx/frontend-app-authoring
-
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.
feat: Change behaviour of Tag Drawer on click outside
* Avoid close Tags drawer on edit * To avoid lose user data * Wrap with ContentTagsDrawerSheet to build drawer on MFE * ContentTagsDrawerSheetContext created * Not close drawer with Escape is pressed when container is blocked
- Loading branch information
Showing
9 changed files
with
158 additions
and
46 deletions.
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
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,44 @@ | ||
// @ts-check | ||
import React, { useMemo, useState } from 'react'; | ||
import { Sheet } from '@openedx/paragon'; | ||
import PropTypes from 'prop-types'; | ||
import ContentTagsDrawer from './ContentTagsDrawer'; | ||
import { ContentTagsDrawerSheetContext } from './common/context'; | ||
|
||
const ContentTagsDrawerSheet = ({ id, onClose, showSheet }) => { | ||
const [blockingSheet, setBlockingSheet] = useState(false); | ||
|
||
const context = useMemo(() => ({ | ||
blockingSheet, setBlockingSheet, | ||
}), [blockingSheet, setBlockingSheet]); | ||
|
||
return ( | ||
<ContentTagsDrawerSheetContext.Provider value={context}> | ||
<Sheet | ||
position="right" | ||
show={showSheet} | ||
onClose={onClose} | ||
blocking={blockingSheet} | ||
> | ||
<ContentTagsDrawer | ||
id={id} | ||
onClose={onClose} | ||
/> | ||
</Sheet> | ||
</ContentTagsDrawerSheetContext.Provider> | ||
); | ||
}; | ||
|
||
ContentTagsDrawerSheet.propTypes = { | ||
id: PropTypes.string, | ||
onClose: PropTypes.func, | ||
showSheet: PropTypes.bool, | ||
}; | ||
|
||
ContentTagsDrawerSheet.defaultProps = { | ||
id: undefined, | ||
onClose: undefined, | ||
showSheet: false, | ||
}; | ||
|
||
export default ContentTagsDrawerSheet; |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export { default as ContentTagsDrawer } from './ContentTagsDrawer'; | ||
// eslint-disable-next-line import/prefer-default-export | ||
export { default as ContentTagsDrawerSheet } from './ContentTagsDrawerSheet'; |
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