Main.ts
1.39 KB
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
/**
* @author : wonseog
* @date : 2021/03/10
* @description : 로그인 이후 첫 화면
* 업데이트하기
* 다른 메뉴 보기
**/
import "@src/assets/style/Main.scss";
import { formatNumber } from "@src/shared/functions";
import { getState } from "@src/store/state";
const Main = () => {
const state = getState();
let followers: string = "";
let following: string = "";
state.followers?.sort().forEach((id, idx) => {
followers += `<div class="item item-${idx % 2}">${id}</div>`;
});
state.following?.sort().forEach((id, idx) => {
following += `<div class="item item-${idx % 2}">${id}</div>`;
});
const followers_num = formatNumber(state.followers?.length || 0);
const followings_num = formatNumber(state.following?.length || 0);
return `
<div class="main">
<div class="profile">
<img src="${state.src}" alt="${state.insta_id}-image"/>
</div>
<div class="list">
<div class="followers">
<h2 class="title">FOLLOWERS (${followers_num})</h2>
<div>${followers}</div>
</div>
<div class="following">
<h2 class="title">FOLLOWINGS (${followings_num})</h2>
<div>${following}</div>
</div>
</div>
</div>
`;
};
export default Main;