about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/display_name.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/flavours/glitch/components/display_name.js')
-rw-r--r--app/javascript/flavours/glitch/components/display_name.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/components/display_name.js b/app/javascript/flavours/glitch/components/display_name.js
new file mode 100644
index 000000000..d6ac4907d
--- /dev/null
+++ b/app/javascript/flavours/glitch/components/display_name.js
@@ -0,0 +1,30 @@
+//  Package imports.
+import classNames from 'classnames';
+import PropTypes from 'prop-types';
+import React from 'react';
+import ImmutablePropTypes from 'react-immutable-proptypes';
+
+//  The component.
+export default function DisplayName ({
+  account,
+  className,
+  inline,
+}) {
+  const computedClass = classNames('display-name', { inline }, className);
+
+  //  The result.
+  return account ? (
+    <span className={computedClass}>
+      <bdi><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }} /></bdi>
+      {inline ? ' ' : null}
+      <span className='display-name__account'>@{account.get('acct')}</span>
+    </span>
+  ) : null;
+}
+
+//  Props.
+DisplayName.propTypes = {
+  account: ImmutablePropTypes.map,
+  className: PropTypes.string,
+  inline: PropTypes.bool,
+};