From 360bf761c0687965c1f10e7a87428c9af2b26df2 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 5 Apr 2019 16:09:51 +0300 Subject: Styling and layout --- vnext/src/components/Message.css | 19 +++++----------- vnext/src/components/Message.js | 24 ++++++++------------ vnext/src/components/UserInfo.js | 47 +++++++++++++++++++++++++--------------- vnext/src/style/main.css | 1 - 4 files changed, 44 insertions(+), 47 deletions(-) diff --git a/vnext/src/components/Message.css b/vnext/src/components/Message.css index 9bc05dc6..55bed2f2 100644 --- a/vnext/src/components/Message.css +++ b/vnext/src/components/Message.css @@ -9,13 +9,14 @@ .msg-cont .msg-header { padding: 12px; } -.msg-cont > nav.l { +.msg-cont > .l { border-top: 1px solid #eee; display: flex; + align-items: center; justify-content: space-around; background: #fdfdfe; } -.msg-cont > nav.l a { +.msg-cont > .l a { color: #88958d; margin-right: 15px; font-size: small; @@ -31,17 +32,6 @@ display: inline-block; font-size: small; } -.l .msg-button { - align-items: center; - display: flex; - flex-basis: 0; - flex-direction: row; - flex-grow: 1; - padding-top: 12px; -} -.l .msg-button-icon { - font-weight: bold; -} .msgthread { margin-bottom: 0; } @@ -144,7 +134,8 @@ blockquote { overflow: hidden; text-indent: 10px; } -.msg-summary { +.msg-summary, +.msg-summary a { color: #88958d; font-size: small; padding: 12px; diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js index 3d063114..c63c5750 100644 --- a/vnext/src/components/Message.js +++ b/vnext/src/components/Message.js @@ -41,34 +41,28 @@ function Message({ data, visitor, children, ...rest }) { {visitor.uid === data.user.uid ? ( - - - - - Recommend - + + + Recommend + ) : visitor.uid > 0 ? ( - - - - Recommend + + Recommend ) : ( - Recommend + Recommend )} {!data.ReadOnly | (visitor.uid === data.user.uid) && ( <> - - - - Comment + + Comment > )} diff --git a/vnext/src/components/UserInfo.js b/vnext/src/components/UserInfo.js index a65bd993..e92ccfd5 100644 --- a/vnext/src/components/UserInfo.js +++ b/vnext/src/components/UserInfo.js @@ -36,28 +36,23 @@ export default function UserInfo(props) { Was online recently + { user.uid > 0 && <> - PM - + + PM + - Recommendations - + + Recommendations + - Photos - - { - user.read && - I read: {user.read.length} - } - My readers: {user.readers ? user.readers.length : 0} - { - user.statsMyBL && - My blacklist: {user.statsMyBL} - } + + Photos + > } @@ -66,6 +61,24 @@ export default function UserInfo(props) { ); } +function Summary({ user }) { + let read = user.read && I read: {user.read.length}; + let readers = user.readers && My readers: {user.readers.length} + let mybl = user.statsMyBL && My blacklist: {user.statsMyBL} + let presentItems = [read, readers, mybl].filter(Boolean); + return ( + + {presentItems.length > 0 && presentItems.reduce((prev, curr) => [prev, ' ', curr])} + + ); +} + +Summary.propTypes = { + user: UserType.isRequired +}; + +const UserSummary = React.memo(Summary); + export function UserLink(props) { const [user, setUser] = useState(props.user); useEffect(() => { @@ -84,8 +97,8 @@ export function UserLink(props) { }, [props.user]); return ( user.uid ? - {user.uname} - : {user.uname} + {user.uname} + : {user.uname} ); } diff --git a/vnext/src/style/main.css b/vnext/src/style/main.css index 9ba06123..496a7771 100644 --- a/vnext/src/style/main.css +++ b/vnext/src/style/main.css @@ -236,7 +236,6 @@ hr { .icon { vertical-align: middle; - margin-right: 12px; } #search input { -- cgit v1.2.3