Skip to content

Instantly share code, notes, and snippets.

@bnhansn
Created October 22, 2016 18:33
Show Gist options
  • Save bnhansn/30a7598efd92e6d0a583a6d7216be4b5 to your computer and use it in GitHub Desktop.
Save bnhansn/30a7598efd92e6d0a583a6d7216be4b5 to your computer and use it in GitHub Desktop.
// @flow
import React from 'react';
import { css, StyleSheet } from 'aphrodite';
const styles = StyleSheet.create({
roomSidebar: {
color: '#ab9ba9',
background: '#4d394b',
},
header: {
padding: '20px 15px',
marginBottom: '10px',
width: '220px',
},
roomName: {
marginBottom: '0',
fontSize: '22px',
lineHeight: '1',
color: '#fff',
},
userList: {
paddingLeft: '15px',
listStyle: 'none',
},
username: {
position: 'relative',
paddingLeft: '20px',
fontSize: '14px',
fontWeight: '300',
':after': {
position: 'absolute',
top: '7px',
left: '0',
width: '8px',
height: '8px',
borderRadius: '50%',
background: 'rgb(64,151,141)',
content: '""',
},
},
listHeading: {
marginLeft: '15px',
marginBottom: '5px',
fontSize: '13px',
textTransform: 'uppercase',
},
});
type User = {
id: number,
username: string,
}
type Props = {
room: {
name: string,
},
currentUser: {
username: string,
},
presentUsers: Array<User>,
}
const RoomSidebar = ({ room, currentUser, presentUsers }: Props) =>
<div className={css(styles.roomSidebar)}>
<div className={css(styles.header)}>
<h2 className={css(styles.roomName)}>{room.name}</h2>
<div style={{ fontSize: '13px' }}>{currentUser.username}</div>
</div>
<div className={css(styles.listHeading)}>Active Users</div>
<ul className={css(styles.userList)}>
{presentUsers.map(user =>
<li key={user.id} className={css(styles.username)}>{user.username}</li>
)}
</ul>
</div>;
export default RoomSidebar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment