Skip to content

Commit

Permalink
feat: Add initial TaxonomyTagsDrawer widget
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuf-musleh committed Oct 23, 2023
1 parent d497b01 commit 11610c4
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Head from './head/Head';
import { StudioHome } from './studio-home';
import CourseRerun from './course-rerun';
import { TaxonomyListPage } from './taxonomy';
import { TaxonomyTagsDrawer } from './taxonomy-tags-drawer';

import 'react-datepicker/dist/react-datepicker.css';
import './index.scss';
Expand Down Expand Up @@ -53,10 +54,16 @@ const App = () => {
<Route path="/course/:courseId/*" element={<CourseAuthoringRoutes />} />
<Route path="/course_rerun/:courseId" element={<CourseRerun />} />
{process.env.ENABLE_TAGGING_TAXONOMY_PAGES === 'true' && (
<Route
path="/taxonomy-list"
element={<TaxonomyListPage />}
/>
<>
<Route
path="/taxonomy-list"
element={<TaxonomyListPage />}
/>
<Route
path="/tagging/components/widget/:contentId"
element={<TaxonomyTagsDrawer />}
/>
</>
)}
</Routes>
</QueryClientProvider>
Expand Down
30 changes: 30 additions & 0 deletions src/taxonomy-tags-drawer/TaxonomyTagsDrawer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import {
Container,
CloseButton,
} from '@edx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import messages from './messages';

const TaxonomyTagsDrawer = ({ intl }) => {
const closeTaxonomyTagsDrawer = () => {
// "*" allows communication with any origin
window.parent.postMessage('closeManageTagsDrawer', '*');
};

return (

<div className="bg-light-400 mt-1">
<Container size="xl">
<CloseButton onClick={() => closeTaxonomyTagsDrawer()} />
<h1>{intl.formatMessage(messages.headerTitle)}</h1>
</Container>
</div>
);
};

TaxonomyTagsDrawer.propTypes = {
intl: intlShape.isRequired,
};

export default injectIntl(TaxonomyTagsDrawer);
2 changes: 2 additions & 0 deletions src/taxonomy-tags-drawer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line import/prefer-default-export
export { default as TaxonomyTagsDrawer } from './TaxonomyTagsDrawer';
10 changes: 10 additions & 0 deletions src/taxonomy-tags-drawer/messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineMessages } from '@edx/frontend-platform/i18n';

const messages = defineMessages({
headerTitle: {
id: 'course-authoring.taxonomy-tags-drawer.header.title',
defaultMessage: 'This is the TaxonomyTagsDrawer!',
},
});

export default messages;

0 comments on commit 11610c4

Please sign in to comment.