Skip to content

Commit 7a39a55

Browse files
committed
Some more design
1 parent f5245da commit 7a39a55

File tree

5 files changed

+77
-36
lines changed

5 files changed

+77
-36
lines changed

app/src/App.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
#main {
2+
display: flex;
3+
height: 100%;
4+
width: 100%;
5+
align-items: center;
6+
justify-content: center;
7+
flex-direction: column;
8+
}
9+
10+
#title {
11+
width: 75%;
12+
color: white;
13+
font-size: 4em;
14+
text-shadow: 0 1px 0 #ccc,
15+
0 2px 0 #c9c9c9,
16+
0 3px 0 #bbb,
17+
0 4px 0 #b9b9b9,
18+
0 5px 0 #aaa;
19+
margin-bottom: 10px;
20+
}
21+
22+
#box-init {
23+
display: flex;
24+
height: 75%;
25+
width: 75%;
26+
align-items: center;
27+
justify-content: center;
28+
background-color: #F5F7F9;
29+
border-left: 3px solid #69c;
30+
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
31+
}
32+
133
#box-main {
234
display: flex;
335
height: 75%;

app/src/App.js

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ class App extends Component {
6464
}
6565

6666
componentDidUpdate() {
67-
// keep message box scrolled appropriately with new messages
6867
if (!this.state.init) {
68+
// keep message box scrolled appropriately with new messages
6969
document.getElementById("conversation-main").scrollTop = document.getElementById("conversation-main").scrollHeight;
7070

7171
console.log("componentDidUpdate")
@@ -96,41 +96,47 @@ class App extends Component {
9696
}
9797

9898
render() {
99-
console.log(this.state);
10099
return (
101-
<div id="box-main">
102-
{this.state.init &&
103-
<Login participantSubmit={this.participantSubmit} />
104-
}
105-
{!this.state.init &&
106-
<div style={{width: "100%", height: "100%"}}>
107-
<div id="top">
108-
<div id="participants-main">
109-
<b>{`Participants (${this.state.participants.length}):`}</b>
110-
{this.state.participants.map(participant =>
111-
<div>{participant}</div>
112-
)}
113-
</div>
114-
<div id="conversation-main">
115-
<a href="https://github.com/stefaluc/go-react-chat"
116-
id="source"
117-
target="_blank"
118-
rel="noopener noreferrer">View source code</a>
119-
{this.state.messages.map(message =>
120-
<Message message={message} />
121-
)}
122-
</div>
100+
<div id="main">
101+
<div id="title">
102+
go-react-chat
103+
</div>
104+
{this.state.init &&
105+
<div id="box-init">
106+
<Login participantSubmit={this.participantSubmit} />
123107
</div>
124-
<div id="bottom">
125-
<div id="text-entry-main">
126-
<form onSubmit={this.textSubmit} id="text-entry-form">
127-
<input type="text" id="text-entry-input" />
128-
</form>
108+
}
109+
{!this.state.init &&
110+
<div id="box-main">
111+
<div style={{width: "100%", height: "100%"}}>
112+
<div id="top">
113+
<div id="participants-main">
114+
<b>{`Participants (${this.state.participants.length}):`}</b>
115+
{this.state.participants.map(participant =>
116+
<div>{participant}</div>
117+
)}
118+
</div>
119+
<div id="conversation-main">
120+
<a href="https://github.com/stefaluc/go-react-chat"
121+
id="source"
122+
target="_blank"
123+
rel="noopener noreferrer">View source code</a>
124+
{this.state.messages.map(message =>
125+
<Message message={message} />
126+
)}
127+
</div>
128+
</div>
129+
<div id="bottom">
130+
<div id="text-entry-main">
131+
<form onSubmit={this.textSubmit} id="text-entry-form">
132+
<input type="text" id="text-entry-input" />
133+
</form>
134+
</div>
129135
</div>
130136
</div>
131137
</div>
132-
}
133-
</div>
138+
}
139+
</div>
134140
);
135141
}
136142
}

app/src/index.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ a {
1515
}
1616

1717
#root {
18-
display: flex;
1918
height: 100%;
2019
width: 100%;
21-
align-items: center;
22-
justify-content: center;
2320
}

app/src/styles/Login.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,10 @@
22
display: flex;
33
align-items: center;
44
justify-content: center;
5+
width: 100%;
6+
}
7+
8+
#participant-form {
9+
height: 30px;
10+
padding: 10px;
511
}

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func main() {
1212
// start conn_hub
1313
hub := newConnHub()
1414
go hub.run()
15-
// serve create-react-app-bundle
15+
// serve create-react-app bundle
1616
fs := http.FileServer(http.Dir("./app/build"))
1717
http.Handle("/", fs)
1818
// serve websocket route
@@ -21,8 +21,8 @@ func main() {
2121
})
2222
// start server
2323
var port string
24+
// let heroku set port in production
2425
if os.Getenv("GO_ENV") == "PRODUCTION" {
25-
// let heroku set port in production
2626
port = ":" + os.Getenv("PORT")
2727
} else {
2828
port = ":8081"

0 commit comments

Comments
 (0)