diff --git a/src/components/ui/Nav.js b/src/components/ui/Nav.js new file mode 100644 index 00000000..21577d82 --- /dev/null +++ b/src/components/ui/Nav.js @@ -0,0 +1,59 @@ +import React from 'react' +import Link from 'next/link'; +import { useState } from 'react'; +import PropTypes from 'prop-types'; + +/** + * Displays a navigation bar with logo and menu links + * @param {Object} props object with the following properties: + * { + * logo: The relative url to the logo image + * navMenu: An array of objects with menu items. E.g : [{ title: 'Blog', path: '/blog' },{ title: 'Search', path: '/search' }] + * } + * @returns React Component + */ +const Nav = ({ logo, navMenu }) => { + const [open, setOpen] = useState(false); + const handleClick = (event) => { + event.preventDefault(); + setOpen(!open); + }; + + return ( + + ); +}; + +Nav.propTypes = { + logo: PropTypes.string.isRequired, + navMenu: PropTypes.string +} +export default Nav; diff --git a/src/components/ui/Recent.js b/src/components/ui/Recent.js new file mode 100644 index 00000000..665d0201 --- /dev/null +++ b/src/components/ui/Recent.js @@ -0,0 +1,51 @@ +import React from 'react'; +import Link from 'next/link'; +import PropTypes from 'prop-types'; + +/** + * Displays a list of recent datasets + * @param {object} props + * datasets = { + * organization: {name: , title: }, + * title: + * name: + * description: + * notes: + * } + * @returns React Component + */ +const Recent = ({datasets}) => { + + return ( +
+

Recent Datasets

+
+ {datasets.map((dataset, index) => ( +
+

{dataset.title}

+

+ {dataset.organization && dataset.organization.description} +

+ + + View Dataset + + +
+ ))} +
+
+ ); +}; + +Recent.propTypes = { + datasets: PropTypes.object.isRequired +} + +export default Recent;