ref(chat): add a header for holding the close button

This commit is contained in:
Leonard Kim 2019-05-02 13:53:17 -07:00 committed by virtuacoplenny
parent 0318568a30
commit 01458eeff9
2 changed files with 46 additions and 22 deletions

View File

@ -42,7 +42,6 @@
flex: 1; flex: 1;
font-size: 10pt; font-size: 10pt;
line-height: 20px; line-height: 20px;
margin-top: $desktopAppDragBarHeight + 5px;
overflow: auto; overflow: auto;
padding: 5px; padding: 5px;
text-align: left; text-align: left;
@ -92,21 +91,32 @@
} }
} }
.chat-close { .chat-header {
background: gray; background-color: rgba(42, 58, 75, 0.9);
border: 3px solid rgba(255, 255, 255, 0.1); height: 70px;
border-radius: 100%; position: relative;
color: white; width: 100%;
cursor:pointer;
height: 10px;
line-height: 10px;
padding: 4px;
position: absolute;
right: 5px;
text-align: center;
top: $desktopAppDragBarHeight;
width: 10px;
z-index: 1; z-index: 1;
.chat-close {
align-items: center;
bottom: 8px;
color: white;
cursor: pointer;
display: flex;
font-size: 18px;
height: 40px;
justify-content: center;
line-height: 15px;
padding: 4px;
position: absolute;
right: 5px;
width: 40px;
&:hover {
color: rgba(255, 255, 255, 0.8);
}
}
} }
#chat-input { #chat-input {
@ -146,14 +156,12 @@
} }
#nickname { #nickname {
position: absolute;
text-align: center; text-align: center;
color: #9d9d9d; color: #9d9d9d;
font-size: 18px; font-size: 18px;
top: 100px; margin-top: 30px;
left: 5px; left: 5px;
right: 5px; right: 5px;
width: 95%;
} }
#chat_container .display-name { #chat_container .display-name {

View File

@ -106,6 +106,7 @@ class Chat extends AbstractChat<Props> {
<div <div
className = 'sideToolbarContainer__inner' className = 'sideToolbarContainer__inner'
id = 'chat_container'> id = 'chat_container'>
{ this._renderChatHeader() }
<div id = 'chatconversation'> <div id = 'chatconversation'>
{ messages } { messages }
</div> </div>
@ -114,6 +115,23 @@ class Chat extends AbstractChat<Props> {
); );
} }
/**
* Instantiates a React Element to display at the top of {@code Chat} to
* close {@code Chat}.
*
* @private
* @returns {ReactElement}
*/
_renderChatHeader() {
return (
<div className = 'chat-header'>
<div
className = 'chat-close'
onClick = { this.props._onToggleChat }>X</div>
</div>
);
}
_renderMessage: (Object) => void; _renderMessage: (Object) => void;
/** /**
@ -145,14 +163,12 @@ class Chat extends AbstractChat<Props> {
_renderPanelContent(state) { _renderPanelContent(state) {
this._isExited = state === 'exited'; this._isExited = state === 'exited';
const { _isOpen, _onToggleChat, _showNamePrompt } = this.props; const { _isOpen, _showNamePrompt } = this.props;
const ComponentToRender = !_isOpen && state === 'exited' const ComponentToRender = !_isOpen && state === 'exited'
? null ? null
: ( : (
<div> <div>
<div { this._renderChatHeader() }
className = 'chat-close'
onClick = { _onToggleChat }>X</div>
{ _showNamePrompt { _showNamePrompt
? <DisplayNameForm /> : this._renderChat() } ? <DisplayNameForm /> : this._renderChat() }
</div> </div>