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.
- Loading branch information
Showing
8 changed files
with
235 additions
and
8 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export { default as TaxonomyListPage } from './TaxonomyListPage'; | ||
export { TaxonomyDetailPage } from './taxonomy-detail'; |
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,42 @@ | ||
import { | ||
DataTable, | ||
TextFilter, | ||
} from '@edx/paragon'; | ||
import Proptypes from 'prop-types'; | ||
|
||
const tagsSample = [ | ||
{ name: 'Tag 1' }, | ||
{ name: 'Tag 2' }, | ||
{ name: 'Tag 3' }, | ||
{ name: 'Tag 4' }, | ||
{ name: 'Tag 5' }, | ||
{ name: 'Tag 6' }, | ||
{ name: 'Tag 7' }, | ||
]; | ||
|
||
const TagListTable = ({ tags }) => ( | ||
<DataTable | ||
isFilterable | ||
isSortable | ||
defaultColumnValues={{ Filter: TextFilter }} | ||
itemCount={tagsSample.length} | ||
data={tagsSample} | ||
columns={[ | ||
{ | ||
Header: 'Name', | ||
accessor: 'name', | ||
}, | ||
]} | ||
> | ||
<DataTable.TableControlBar /> | ||
<DataTable.Table /> | ||
<DataTable.EmptyTable content="No results found" /> | ||
<DataTable.TableFooter /> | ||
</DataTable> | ||
); | ||
|
||
TagListTable.propTypes = { | ||
tags: Proptypes.array.isRequired, | ||
}; | ||
|
||
export default TagListTable; |
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,97 @@ | ||
import React from 'react'; | ||
import { | ||
Container, | ||
Layout, | ||
} from '@edx/paragon'; | ||
import Proptypes from 'prop-types'; | ||
|
||
import PermissionDeniedAlert from '../../generic/PermissionDeniedAlert'; | ||
import Loading from '../../generic/Loading'; | ||
import Header from '../../header'; | ||
import SubHeader from '../../generic/sub-header/SubHeader'; | ||
import TaxonomyDetailSideCard from './TaxonomyDetailSideCard'; | ||
import TagListTable from './TagListTable'; | ||
import { useTaxonomyDetailDataResponse, useTaxonomyDetailDataStatus } from '../api/hooks/selectors'; | ||
|
||
const TaxonomyDetailContent = ({ taxonomyId }) => { | ||
const useTaxonomyDetailData = () => { | ||
const { isError, isFetched } = useTaxonomyDetailDataStatus(taxonomyId); | ||
const taxonomy = useTaxonomyDetailDataResponse(taxonomyId); | ||
return { isError, isFetched, taxonomy }; | ||
}; | ||
|
||
const { isError, isFetched, taxonomy } = useTaxonomyDetailData(taxonomyId); | ||
|
||
if (isError) { | ||
return ( | ||
<PermissionDeniedAlert /> | ||
); | ||
} | ||
|
||
if (!isFetched) { | ||
return ( | ||
<Loading /> | ||
); | ||
} | ||
|
||
if (taxonomy) { | ||
return ( | ||
<> | ||
<div className="pt-4.5 pr-4.5 pl-4.5 pb-2 bg-light-100 box-shadow-down-2"> | ||
<Container size="xl"> | ||
<SubHeader | ||
title={taxonomy.name} | ||
hideBorder | ||
/> | ||
</Container> | ||
</div> | ||
<div className="bg-light-400 m-4"> | ||
<Layout | ||
lg={[{ span: 9 }, { span: 3 }]} | ||
md={[{ span: 9 }, { span: 3 }]} | ||
sm={[{ span: 9 }, { span: 3 }]} | ||
xs={[{ span: 9 }, { span: 3 }]} | ||
xl={[{ span: 9 }, { span: 3 }]} | ||
> | ||
<Layout.Element> | ||
<TagListTable /> | ||
</Layout.Element> | ||
<Layout.Element> | ||
<TaxonomyDetailSideCard taxonomy={taxonomy} /> | ||
</Layout.Element> | ||
|
||
</Layout> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
return undefined; | ||
}; | ||
|
||
const TaxonomyDetailPage = ({ taxonomyId }) => ( | ||
<> | ||
<style> | ||
{` | ||
body { | ||
background-color: #E9E6E4; /* light-400 */ | ||
} | ||
`} | ||
</style> | ||
<Header isHiddenMainMenu /> | ||
<TaxonomyDetailContent taxonomyId={taxonomyId} /> | ||
</> | ||
); | ||
|
||
TaxonomyDetailPage.propTypes = { | ||
taxonomyId: Proptypes.number, | ||
}; | ||
|
||
TaxonomyDetailPage.defaultProps = { | ||
taxonomyId: undefined, | ||
}; | ||
|
||
TaxonomyDetailContent.propTypes = TaxonomyDetailPage.propTypes; | ||
TaxonomyDetailContent.defaultProps = TaxonomyDetailPage.defaultProps; | ||
|
||
export default TaxonomyDetailPage; |
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,27 @@ | ||
import { | ||
Card, | ||
} from '@edx/paragon'; | ||
import Proptypes from 'prop-types'; | ||
|
||
const TaxonomyDetailSideCard = ({ taxonomy }) => ( | ||
<Card> | ||
<Card.Header title="Taxonomy details" /> | ||
<Card.Section title="Title"> | ||
{taxonomy.name} | ||
</Card.Section> | ||
<Card.Divider className="ml-3 mr-3" /> | ||
<Card.Section title="Description"> | ||
{taxonomy.description} | ||
</Card.Section> | ||
<Card.Divider className="ml-3 mr-3" /> | ||
<Card.Section title="Copyright"> | ||
No copyright added | ||
</Card.Section> | ||
</Card> | ||
); | ||
|
||
TaxonomyDetailSideCard.propTypes = { | ||
taxonomy: Proptypes.object.isRequired, | ||
}; | ||
|
||
export default TaxonomyDetailSideCard; |
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,2 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export { default as TaxonomyDetailPage } from './TaxonomyDetailPage'; |