forked from joaquin-mari/Augsburg-Developers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFloatingPhone.jsx
70 lines (67 loc) · 2.14 KB
/
FloatingPhone.jsx
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import React, { useState } from "react";
import { Bar } from "react-chartjs-2";
import { PieChart } from "react-minimal-pie-chart";
import { MdCameraAlt, MdHome, MdPersonOutline } from "react-icons/md";
import "./FloatingPhone.css";
import { CameraScreen } from "./CameraScreen";
import { ProfileScreen } from "./ProfileScreen";
const dataMock = [
{ title: "Proteins", value: 25, color: "#acd1c0" },
{ title: "Greens", value: 20, color: "#ddd4b7" },
{ title: "Calories", value: 30, color: "#deb887" },
{ title: "Fat", value: 25, color: "#201e21" },
];
export default function FloatingPhone() {
const [showCamera, setShowCamera] = useState(false);
const [showProfile, setShowProfile] = useState(false);
return (
<div className="floating-phone">
<div className="screen">
{showCamera && <CameraScreen />}
{showProfile && <ProfileScreen />}
{!showCamera && !showProfile && (
<div className="chart-and-labels">
<div className="chart-container">
<PieChart data={dataMock} radius={35} lineWidth={50} animate />
</div>
<div className="labels-container">
{dataMock.map((item, index) => (
<div key={index} className="bar-chart-container">
<span>{item.title}</span>
<progress
data-title={item.title}
value={item.value}
max="100"
/>
</div>
))}
</div>
</div>
)}
<div className="nav-bar">
<MdCameraAlt
className="icon"
onClick={() => {
setShowCamera(true);
setShowProfile(false);
}}
/>
<MdHome
className="icon"
onClick={() => {
setShowCamera(false);
setShowProfile(false);
}}
/>
<MdPersonOutline
className="icon"
onClick={() => {
setShowCamera(false);
setShowProfile(true);
}}
/>
</div>
</div>
</div>
);
}