Main.ts 1 KB
/**
 * @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 = "";

  state.follower?.forEach((follower, idx) => {
    followers += `<div class="item item-${idx % 2}">${follower[0]}</div>`;
  });

  const followers_num = formatNumber(state.follower?.length || 0);

  return `
        <div class="main">
            <div class="profile">
                <img src="${state}" alt="${state.user[0]}-image"/>
            </div>
            <div class="list">
                <div class="followers">
                    <h2 class="title">FOLLOWERS (${followers_num})</h2>
                    <div>${followers}</div>
                </div>
            </div>
        </div>
    `;
};

export default Main;