Skip to content

Commit

Permalink
[#123] bugfix: change if-box order
Browse files Browse the repository at this point in the history
  • Loading branch information
rosieyeon committed Feb 17, 2022
1 parent b85e349 commit 8cc33cd
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions src/components/home/statistics/if.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import axios from 'axios';
import { useEffect, useState } from 'react';
import '../../../statics/css/home/if.css';
import axios from "axios";
import { useEffect, useState } from "react";
import "../../../statics/css/home/if.css";

export default function IfIWere() {
const [timeTotal, setTimeTotal] = useState('');
const [timeTotal, setTimeTotal] = useState("");
useEffect(() => {
axios
.get(process.env.REACT_APP_SERVER_URL + '/users', {
.get(process.env.REACT_APP_SERVER_URL + "/users", {
headers: {
Authorization: `Bearer ` + localStorage.getItem('accessToken'),
Authorization: `Bearer ` + localStorage.getItem("accessToken"),
},
})
.then((res) => {
Expand All @@ -25,55 +25,69 @@ export default function IfIWere() {
<div className="if-header">
<div className="if-header__header">누적 공부시간</div>
<div className="if-header__body">
{parseInt(timeTotal / 60)}시간 {timeTotal - parseInt(timeTotal / 60) * 60}
{parseInt(timeTotal / 60)}시간{" "}
{timeTotal - parseInt(timeTotal / 60) * 60}
</div>
</div>
<div className="if-body">
<div className="if-body__box">
<div className="if-body__box-header">3분카레</div>
{timeTotal ? (
<div className="if-body__box-body">{parseInt(timeTotal / 3).toLocaleString('ko-KR')}개 제조</div>
<div className="if-body__box-body">
{parseInt(timeTotal / 3).toLocaleString("ko-KR")}개 제조
</div>
) : (
<div className="if-body__box-body">0개 제조</div>
)}
</div>
<div className="if-body__box">
<div className="if-body__box-header">서울에서 뉴욕까지</div>
<div className="if-body__box-body">{(timeTotal / 1680).toFixed(1)}회 왕복</div>
<div className="if-body__box-body">
{(timeTotal / 1680).toFixed(1)}회 왕복
</div>
</div>
<div className="if-body__box">
<div className="if-body__box-header">1분 영어단어</div>
{timeTotal ? (
<div className="if-body__box-body">{timeTotal.toLocaleString('ko-KR')}개 암기</div>
<div className="if-body__box-body">
{timeTotal.toLocaleString("ko-KR")}개 암기
</div>
) : (
<div className="if-body__box-body">0개 암기</div>
)}
</div>
<div className="if-body__box">
<div className="if-body__box-header">책읽기</div>
<div className="if-body__box-body">{parseInt(timeTotal / 150)}</div>
<div className="if-body__box-body">
{parseInt(timeTotal / 150)}
</div>
</div>
<div className="if-body__box">
<div className="if-body__box-header">걸어서</div>
{timeTotal ? (
<div className="if-body__box-body">
{(parseInt(timeTotal / 60) * 235).toLocaleString('ko-KR')}kcal 소모
{(parseInt(timeTotal / 60) * 235).toLocaleString("ko-KR")}kcal
소모
</div>
) : (
<div className="if-body__box-body">0kcal 소모</div>
)}
</div>
<div className="if-body__box">
<div className="if-body__box-header">노래방에서</div>
<div className="if-body__box-body">{parseInt(timeTotal / 3.75).toLocaleString('ko-KR')}곡 부르기</div>
<div className="if-body__box-body">
{parseInt(timeTotal / 3.75).toLocaleString("ko-KR")}곡 부르기
</div>
</div>
<div className="if-body__box">
<div className="if-body__box-header">연애할 수 있는 횟수</div>
<div className="if-body__box-body">0회</div>
<div className="if-body__box-header">영화 관람</div>
<div className="if-body__box-body">
{(timeTotal / 127).toFixed(1)}
</div>
</div>
<div className="if-body__box">
<div className="if-body__box-header">영화 관람</div>
<div className="if-body__box-body">{(timeTotal / 127).toFixed(1)}</div>
<div className="if-body__box-header">연애할 수 있는 횟수</div>
<div className="if-body__box-body">0회</div>
</div>
</div>
</div>
Expand Down

0 comments on commit 8cc33cd

Please sign in to comment.