Skip to content

Commit

Permalink
feat(airdrop): comfirm modal title
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJay1024 committed Jan 18, 2022
1 parent 5eabdaf commit 2dc4971
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 29 deletions.
60 changes: 60 additions & 0 deletions src/component/ClaimAirdrop/SubComponent/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React from 'react';
import clsx from 'clsx';
import styles from '../styles.module.scss';
import { Modal } from 'antd';

export const ComfirmModalTitleWithCRAB = ({ crabQuantity='100' }) => (
<div className={clsx(styles.titleComfirmModalWithCRAB)}>
<span>Claim CRAB Token</span>
<span>{crabQuantity} CRAB</span>
</div>
);

export const ComfirmModalTitleForSorry = ({ crabQuantity='200,000' }) => (
<div className={clsx(styles.titleComfirmModalForSorry)}>
<span>{`Sorry, ${crabQuantity} CRAB has been distributed.`}</span>
</div>
);

export const ComfirmModalTitleForComfirm = () => (
<div className={clsx(styles.titleComfirmModalForComfirm)}>
<span>Confirm Information</span>
<span>Please review your destination address</span>
</div>
);

export const ComfirmModalTitleForCcongratulation = () => (
<div className={clsx(styles.titleComfirmModalForCongratulation)}>
<span>Congratulations!</span>
</div>
);

export const ComfirmModalButton = ({
text='OK',
onClick=()=>{},
disabled=false,
}) => (
<button className={clsx(styles.btnComfirmModal)} onClick={onClick} disabled={disabled}>
<span>{text}</span>
</button>
)

export const ComfirmModal = ({
visible=false,
title=null,
footer=null,
children=null,
onCancel=()=>{},
}) => {
return (
<Modal
visible={visible}
title={title}
footer={footer}
onCancel={onCancel}
className={clsx(styles.comfirmModal)}
>
{children}
</Modal>
);
};
39 changes: 10 additions & 29 deletions src/component/ClaimAirdrop/index.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,14 @@
import React, { useState } from 'react';
import clsx from 'clsx';
import styles from './styles.module.scss';
import { Modal } from 'antd';

const ComfirmModalButton = ({
text='OK',
onClick=()=>{},
disabled=false,
}) => (
<button className={clsx(styles.btnComfirmModal)} onClick={onClick} disabled={disabled}>
<span>{text}</span>
</button>
)

const ComfirmModal = ({
visible=false,
title=null,
footer=null,
children=null,
}) => {
return (
<Modal
visible={visible}
title={title}
footer={footer}
className={clsx(styles.comfirmModal)}
>
{children}
</Modal>
);
};
import {
ComfirmModal,
ComfirmModalButton,
ComfirmModalTitleWithCRAB,
ComfirmModalTitleForSorry,
ComfirmModalTitleForComfirm,
ComfirmModalTitleForCcongratulation,
} from './SubComponent';

type Props = {
className?: string;
Expand All @@ -52,7 +31,9 @@ const ClaimAirdrop: React.FC<Props> = ({ className }) => {
</div>
<ComfirmModal
visible={visibleComfirmModal}
title={<ComfirmModalTitleForCcongratulation />}
footer={<ComfirmModalButton onClick={() => setVisibleComfirmModal(false)} disabled={true} />}
onCancel={() => setVisibleComfirmModal(false)}
/>
</>
);
Expand Down
65 changes: 65 additions & 0 deletions src/component/ClaimAirdrop/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,71 @@
}
}

.titleComfirmModalWithCRAB {
display: flex;
flex-direction: column;
width: 100%;

>span {
color: #ffffff;

&:first-child {
font-size: small;
margin-bottom: 10px;
}

&:last-child {
font-weight: bolder;
}
}
}

.titleComfirmModalForSorry {
width: 100%;
padding: 15px 0;
display: flex;
align-items: center;
justify-content: center;

>span {
color: #ffffff;
font-size: small;
}
}

.titleComfirmModalForComfirm {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;

>span {
color: #ffffff;

&:first-child {
font-weight: bolder;
margin-bottom: 6px;
}

&:last-child {
font-size: small;
}
}
}

.titleComfirmModalForCongratulation {
width: 100%;
padding: 18px 0;
display: flex;
align-items: center;
justify-content: center;

>span {
color: #ffffff;
font-weight: bolder;
}
}

.comfirmModal {
:global {
.ant-modal-content {
Expand Down

0 comments on commit 2dc4971

Please sign in to comment.