-
Notifications
You must be signed in to change notification settings - Fork 627
Expand file tree
/
Copy pathWelcome.jsx
More file actions
37 lines (36 loc) · 831 Bytes
/
Copy pathWelcome.jsx
File metadata and controls
37 lines (36 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React, { useState, useEffect } from "react";
import styled from "styled-components";
import Robot from "../assets/robot.gif";
import userById from "../utils/backendCall";
export default function Welcome() {
const [userName, setUserName] = useState("");
useEffect(() => {
async function fetchData() {
const user = await userById();
setUserName(user.username);
}
fetchData();
}, []);
return (
<Container>
<img src={Robot} alt="" />
<h1>
Welcome, <span>{userName}!</span>
</h1>
<h3>Please select a chat to Start messaging.</h3>
</Container>
);
}
const Container = styled.div`
display: flex;
justify-content: center;
align-items: center;
color: white;
flex-direction: column;
img {
height: 20rem;
}
span {
color: #4e0eff;
}
`;