From 6ea8e69d331067a9ac8da267bd09e689e2a171d2 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 17 Jun 2018 01:54:48 +0300 Subject: Avatar component --- vnext/src/components/Avatar.js | 15 +++++++++++++++ vnext/src/components/Message.js | 31 ++++++++++++++----------------- vnext/src/components/Types.js | 6 ++++++ 3 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 vnext/src/components/Avatar.js create mode 100644 vnext/src/components/Types.js (limited to 'vnext/src/components') diff --git a/vnext/src/components/Avatar.js b/vnext/src/components/Avatar.js new file mode 100644 index 00000000..72b5d2d1 --- /dev/null +++ b/vnext/src/components/Avatar.js @@ -0,0 +1,15 @@ +import React from 'react'; + +import { UserType } from './Types'; + +export default function Avatar(props) { + return ( +
+ {`${props.user.uname}`} +
+ ); +} + +Avatar.propTypes = { + user: UserType +} diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js index 0c322a66..d1a9c51f 100644 --- a/vnext/src/components/Message.js +++ b/vnext/src/components/Message.js @@ -3,7 +3,9 @@ import PropTypes from 'prop-types'; import ReactMarkdown from 'react-markdown'; import moment from 'moment'; +import { UserType } from './Types'; import Icon from './Icon'; +import Avatar from './Avatar'; export default function Message(props) { const msg = props.data; @@ -14,9 +16,7 @@ export default function Message(props) { -
- {`${msg.user.uname}`} -
+