Skip to content

Commit

Permalink
fear(airdrop): loading modal
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJay1024 committed Jan 18, 2022
1 parent 2dc4971 commit 40fa9f1
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
22 changes: 21 additions & 1 deletion src/component/ClaimAirdrop/SubComponent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import clsx from 'clsx';
import styles from '../styles.module.scss';
import { Modal } from 'antd';
import { Modal, Spin } from 'antd';

export const ComfirmModalTitleWithCRAB = ({ crabQuantity='100' }) => (
<div className={clsx(styles.titleComfirmModalWithCRAB)}>
Expand Down Expand Up @@ -58,3 +58,23 @@ export const ComfirmModal = ({
</Modal>
);
};

export const LoadingModal = ({
visible=false,
onCancel=()=>{},
}) => {
return (
<Modal
visible={visible}
title={null}
footer={null}
onCancel={onCancel}
className={clsx(styles.loadingModal)}
>
<div className={clsx(styles.loadingModalBody)}>
<Spin size='large' className={clsx(styles.loadingModalSpin)} indicator={<div className={styles.indicator} />} />
<p>Waiting For Confirmation</p>
</div>
</Modal>
)
};
8 changes: 7 additions & 1 deletion src/component/ClaimAirdrop/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from 'react';
import clsx from 'clsx';
import styles from './styles.module.scss';
import {
LoadingModal,
ComfirmModal,
ComfirmModalButton,
ComfirmModalTitleWithCRAB,
Expand All @@ -15,7 +16,8 @@ type Props = {
}

const ClaimAirdrop: React.FC<Props> = ({ className }) => {
const [visibleComfirmModal, setVisibleComfirmModal] = useState(true);
const [visibleLoadingModal, setVisibleLoadingModal] = useState(true);
const [visibleComfirmModal, setVisibleComfirmModal] = useState(false);

const handleClickLoginWithGithub = (e: Event) => {
e.preventDefault();
Expand All @@ -35,6 +37,10 @@ const ClaimAirdrop: React.FC<Props> = ({ className }) => {
footer={<ComfirmModalButton onClick={() => setVisibleComfirmModal(false)} disabled={true} />}
onCancel={() => setVisibleComfirmModal(false)}
/>
<LoadingModal
visible={visibleLoadingModal}
onCancel={() => setVisibleLoadingModal(false)}
/>
</>
);
};
Expand Down
46 changes: 46 additions & 0 deletions src/component/ClaimAirdrop/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,49 @@
}
}
}

.loadingModal {
:global {
.ant-modal-content {
border-radius: 20px;
}

.ant-modal-close {
color: rgba(0, 0, 0, 0.65);
}
}
}

.loadingModalBody {
margin-top: 60px;
display: flex;
flex-direction: column;
align-items: center;

>p {
margin-top: 20px;
color: #000000;
font-size: small;
}
}

@keyframes crab-spin {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}

.loadingModalSpin {
.indicator {
display: inline-block;
width: 80px;
height: 80px;
border: 4px solid rgba(0, 0, 0, 0.1);
border-left-color: #EC3783;
border-radius: 50%;
animation: crab-spin 1.2s linear infinite;
}
}

0 comments on commit 40fa9f1

Please sign in to comment.