-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #171 from starknet-id/feat/domain-popup
- Loading branch information
Showing
9 changed files
with
239 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { FunctionComponent } from "react"; | ||
import styles from "../../../styles/components/popup.module.css"; | ||
import Button from "../button"; | ||
import CloseIcon from "../iconsComponents/icons/closeIcon"; | ||
|
||
type PopupProps = { | ||
title: string; | ||
banner: string; | ||
description: string; | ||
buttonName: string; | ||
onClick: () => void; | ||
onClose?: () => void; | ||
}; | ||
|
||
const Popup: FunctionComponent<PopupProps> = ({ | ||
title, | ||
banner, | ||
description, | ||
buttonName, | ||
onClick, | ||
onClose, | ||
}) => { | ||
return ( | ||
<div className={styles.popupContainer}> | ||
<div className={styles.popup}> | ||
<div className={styles.titleSide}> | ||
<h1 className={styles.title}>{title}</h1> | ||
<img className={styles.banner} src={banner} alt="banner" /> | ||
</div> | ||
<div className={styles.contentSide}> | ||
<p className={styles.description}>{description}</p> | ||
<div className={styles.button}> | ||
<Button onClick={onClick}>{buttonName}</Button> | ||
</div> | ||
</div> | ||
{onClose && ( | ||
<button onClick={onClose} className={styles.close}> | ||
<CloseIcon width="16" /> | ||
</button> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Popup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import BN from "bn.js"; | ||
import { useContext, useEffect, useState } from "react"; | ||
import { StarknetIdJsContext } from "../context/StarknetIdJsProvider"; | ||
import { hexToDecimal } from "../utils/feltService"; | ||
|
||
export default function useHasRootDomain(address: string | BN | undefined) { | ||
const [hasRootDomain, setHasRootDomain] = useState(false); | ||
const { starknetIdNavigator } = useContext(StarknetIdJsContext); | ||
useEffect(() => { | ||
if (!address) return; | ||
fetch( | ||
`${ | ||
process.env.NEXT_PUBLIC_STARKNET_ID_API_LINK | ||
}/addr_to_domain?addr=${hexToDecimal(address.toString())}` | ||
).then((res) => res.status === 200 && setHasRootDomain(true)); | ||
}, [starknetIdNavigator, address]); | ||
|
||
return hasRootDomain; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
.popupContainer { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
z-index: var(--z-index-popup); | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
} | ||
|
||
.popup { | ||
position: relative; | ||
width: calc(100% - 2rem); | ||
max-width: 800px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); | ||
display: flex; | ||
border-radius: 5px; | ||
background-color: var(--background600); | ||
border-radius: 16px; | ||
} | ||
|
||
.titleSide, | ||
.contentSide { | ||
position: relative; | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
padding: 30.75px 46.125px; | ||
} | ||
|
||
.titleSide { | ||
background-color: var(--menu-background); | ||
max-width: 52%; | ||
border-radius: 16px 0px 0px 16px; | ||
} | ||
|
||
.contentSide { | ||
max-width: 48%; | ||
} | ||
|
||
.title { | ||
color: var(--secondary); | ||
text-align: center; | ||
text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); | ||
|
||
/* Title/H2 */ | ||
font-family: Sora; | ||
font-size: 36px; | ||
font-style: normal; | ||
font-weight: 700; | ||
line-height: 48px; /* 133.333% */ | ||
margin-top: 24px; | ||
} | ||
|
||
.button { | ||
margin-bottom: auto; | ||
} | ||
|
||
.description { | ||
margin: auto 0; | ||
color: var(--secondary); | ||
text-align: center; | ||
|
||
/* Body/default/regular */ | ||
font-family: Sora; | ||
font-size: 16px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 32px; /* 200% */ | ||
} | ||
|
||
.banner { | ||
margin: 24px 0; | ||
} | ||
|
||
.close { | ||
position: absolute; | ||
top: 10px; | ||
right: 10px; | ||
width: 30px; | ||
height: 30px; | ||
cursor: pointer; | ||
stroke: var(--background500); | ||
} | ||
|
||
.close::before, | ||
.close::after { | ||
content: ""; | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
width: 100%; | ||
height: 2px; | ||
background-color: var(--color-black); | ||
transform: translate(-50%, -50%) rotate(45deg); | ||
} | ||
|
||
.close::after { | ||
transform: translate(-50%, -50%) rotate(-45deg); | ||
} | ||
|
||
@media (max-width: 768px) { | ||
.popupContainer { | ||
align-items: flex-end; | ||
} | ||
.popup { | ||
flex-direction: column; | ||
align-items: center; | ||
margin-top: 12vh; | ||
max-height: calc(88vh - 1rem); | ||
overflow-y: auto; | ||
padding: 48px 24px; | ||
background-color: var(--menu-background); | ||
border-radius: 16px 16px 0 0; | ||
} | ||
.titleSide, | ||
.contentSide { | ||
max-width: 100%; | ||
padding: 0 24px; | ||
background-color: unset; | ||
align-items: center; | ||
} | ||
.button { | ||
margin-top: 2rem; | ||
} | ||
.banner { | ||
width: 400px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const starknetIdAppLink = `https://${ | ||
process.env.NEXT_PUBLIC_IS_TESTNET ? "goerli." : "" | ||
}app.starknet.id/`; |
abc4763
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
goerli-starknet-quest – ./
goerli-starknet-quest-git-testnet-starknetid.vercel.app
goerli-starknet-quest-starknetid.vercel.app
goerli-starknet-quest.vercel.app
goerli.starknet.quest