diff -r 000000000000 -r 5f4fcbc80b37 clientjs/packages/dashboard-components/src/ui/DefinitionBlock.jsx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientjs/packages/dashboard-components/src/ui/DefinitionBlock.jsx Fri Sep 14 17:57:34 2018 +0200 @@ -0,0 +1,84 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +import ReactMarkdown from 'react-markdown'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; + +import AnnotationQuote from './AnnotationQuote'; + +import './DefinitionBlock.scss'; + +const DefinitionHeaderIcon = ({ annotation }) => { + const annotationText = annotation.text || ''; + let faIconName; + + if (annotationText) { + faIconName = 'user'; + } else if (/^https?:\/\/.+\.wikipedia\.org/.test(annotation.uri)) { + faIconName = ['fab', 'wikipedia-w']; + } else { + faIconName = 'globe'; + } + + return ; +}; + +DefinitionHeaderIcon.propTypes = { + annotation: PropTypes.object.isRequired, +}; + +const DefinitionUser = ({ annotation }) => { + const [userName] = annotation.user.replace('acct:', '').split('@'); + + return ( + + { userName } + {/* @{ instanceName } */} + + ); +}; + +DefinitionUser.propTypes = { + annotation: PropTypes.object.isRequired, +}; + +const DefinitionBody = ({ annotation, metacategories }) => { + if (annotation.text) { + return ; + } + return ; +}; + +DefinitionBody.propTypes = { + annotation: PropTypes.object.isRequired, + metacategories: PropTypes.arrayOf(PropTypes.object).isRequired, +}; + + +const DefinitionBlock = ({ annotation, metacategories }) => { + const { document } = annotation; + + return ( +
+
+ +
+
+ +
+
+ { document.title } +
+ +
+
+
+ ); +}; + +DefinitionBlock.propTypes = { + annotation: PropTypes.object.isRequired, + metacategories: PropTypes.arrayOf(PropTypes.object).isRequired, +}; + +export default DefinitionBlock;