Skip to content

Commit

Permalink
Added Drupal content page template. (#4)
Browse files Browse the repository at this point in the history
* Added Drupal content page template.

* Added CMSDS container class.
  • Loading branch information
brianseek authored Feb 3, 2021
1 parent ad3f8da commit 24a86ab
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export { default as Pagination } from './components/Pagination';
// Templates
export { default as Footer } from './templates/Footer';
export { default as Dataset } from './templates/Dataset';
export { default as DrupalPage } from './templates/DrupalPage';
18 changes: 18 additions & 0 deletions src/templates/DrupalPage/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";
import { useDrupalEntity } from '@civicactions/data-catalog-services';

const DrupalPage = ({ path, rootURL, uuid, entityType, bundle, options }) => {
const {entity} = useDrupalEntity(rootURL, uuid, entityType, bundle, options);
const bodyContent = Object.keys(entity).length ? (
<div className="dc-page ds-l-container">
<h1>{entity.attributes.title}</h1>
<div className="dc-page-content" dangerouslySetInnerHTML={{ __html: entity.attributes.body.processed }} />
</div>
) : '';
return (
<>
{bodyContent}
</>
);
}
export default DrupalPage;

0 comments on commit 24a86ab

Please sign in to comment.