Skip to content

Commit

Permalink
Feat: loading svg 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehafe committed Feb 20, 2023
1 parent 23a82cc commit 7bcf768
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h1 class="header-main__company-name">마켓로그</h1>
<!-- 메인페이지 라우터 -->
<main class="app"></main>
<div class="loadingGif">
<img src="public/loading.svg" alt="로딩.." id="img-loadingGIF" />
<img src="public/spinner.svg" alt="로딩.." id="img-loadingGIF" />
</div>
<!-- 메인페이지 끝 -->

Expand Down
52 changes: 52 additions & 0 deletions public/spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/js/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Navigo from 'navigo';
import { $ } from './utils/dom.js';
import { htmlMypage_Nav, renderMyPageNav } from './page/mypage.js';
import { htmlMypage_Account, initFuncAccount } from './page/mypage/account';
// import { htmlMypage_MyHeart, initFuncMyHeart } from './page/mypage/wishlist';
Expand Down Expand Up @@ -38,9 +39,8 @@ import {
orderDetailPage,
} from './page/admin/renderTemplate';

const $ = (selector) => document.querySelector(selector);
export const router = new Navigo('/');
const divLoadingEl = $('.loadingGif');
export const divLoadingEl = $('.loadingGif');

function getLoginStatus() {
return localStorage.getItem('token') ? true : false;
Expand Down
4 changes: 4 additions & 0 deletions src/js/page/admin/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import {
import { getAllOrder, getAllProducts } from '../../api.js';
import { formatPrice } from '../../utils/format.js';
import Chart from 'chart.js/auto';
import { divLoadingEl } from '../../main.js';

/** 대시보드 페이지 핸들러 */
export const dashboardHandler = async () => {
divLoadingEl.style.display = 'block';

let orders = await getAllOrder();
let products = await getAllProducts();

Expand All @@ -16,6 +19,7 @@ export const dashboardHandler = async () => {
renderDashboardChart();
setDashBoardChartCategory(products);
setDashBoardChartAmount(orders);
divLoadingEl.style.display = 'none';
};

/** 거래 카테고리 통계 chart 생성 */
Expand Down
1 change: 0 additions & 1 deletion src/js/page/mainPage/mainPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,5 @@ $('.app').addEventListener('click', (e) => {
/** router on '/' 핸들링 함수 */
export const handleMainPage = () => {
$('.modal__addCart').style.display = 'none';
console.log('/ route is working');
renderPage(renderMainPageTemplate);
};

0 comments on commit 7bcf768

Please sign in to comment.