-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Namadillo: Top Navigation improvements (#1475)
* feat(namadillo): top navigation modal components * feat(namadillo): adding copy to clipboard feature to tx hash
- Loading branch information
1 parent
4b87ef6
commit 741fbec
Showing
9 changed files
with
209 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Stack } from "@namada/components"; | ||
import clsx from "clsx"; | ||
|
||
type AssetsModalCard = { | ||
title: string; | ||
icon: React.ReactNode; | ||
onClick: () => void; | ||
} & React.PropsWithChildren; | ||
|
||
export const AssetsModalCard = ({ | ||
title, | ||
icon, | ||
children, | ||
onClick, | ||
}: AssetsModalCard): JSX.Element => { | ||
return ( | ||
<Stack | ||
gap={6} | ||
onClick={onClick} | ||
className={clsx( | ||
"w-[220px] h-full items-stretch pb-8 pt-2.5 px-4 border rounded-md border-transparent transition-colors cursor-pointer", | ||
"items-center text-white text-center hover:border-yellow" | ||
)} | ||
> | ||
<h3 className="text-xl font-medium">{title}</h3> | ||
<aside className="max-w-[78px]">{icon}</aside> | ||
<div className="text-base/tight">{children}</div> | ||
</Stack> | ||
); | ||
}; |
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 { Modal } from "@namada/components"; | ||
import { AssetsModalCard } from "./AssetsModalCard"; | ||
import { ModalContainer } from "./ModalContainer"; | ||
|
||
type Entry = { | ||
title: string; | ||
onClick: () => void; | ||
icon: React.ReactNode; | ||
children: React.ReactNode; | ||
}; | ||
|
||
type SelectOptionModalProps = { | ||
title: string; | ||
onClose: () => void; | ||
items: Entry[]; | ||
}; | ||
|
||
export const SelectOptionModal = ({ | ||
title, | ||
onClose, | ||
items, | ||
}: SelectOptionModalProps): JSX.Element => { | ||
return ( | ||
<Modal onClose={onClose}> | ||
<ModalContainer | ||
header={title} | ||
onClose={onClose} | ||
containerProps={{ className: "!w-auto !h-auto bg-rblack" }} | ||
contentProps={{ className: "pt-0 mt-3" }} | ||
> | ||
<ul className="grid grid-cols-[1fr_1px_1fr] gap-4 pt-1"> | ||
{items.map((item, index) => ( | ||
<> | ||
<li key={index}> | ||
<AssetsModalCard {...item}>{item.children}</AssetsModalCard> | ||
</li> | ||
{index + 1 < items.length && ( | ||
<li className="w-px bg-white -my-1" /> | ||
)} | ||
</> | ||
))} | ||
</ul> | ||
</ModalContainer> | ||
</Modal> | ||
); | ||
}; |
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,45 @@ | ||
import { routes } from "App/routes"; | ||
import { wallets } from "integrations"; | ||
import { getAssetImageUrl } from "integrations/utils"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { namadaAsset } from "utils"; | ||
import { SelectOptionModal } from "./SelectOptionModal"; | ||
|
||
type ShieldAssetsModal = { | ||
onClose: () => void; | ||
}; | ||
|
||
export const ShieldAssetsModal = ({ | ||
onClose, | ||
}: ShieldAssetsModal): JSX.Element => { | ||
const navigate = useNavigate(); | ||
const goTo = (url: string): void => { | ||
navigate(url); | ||
onClose(); | ||
}; | ||
|
||
return ( | ||
<SelectOptionModal | ||
title="Shield Assets" | ||
onClose={onClose} | ||
items={[ | ||
{ | ||
title: "IBC Shield", | ||
icon: <img src={wallets.keplr.iconUrl} className="w-full" />, | ||
onClick: () => goTo(routes.ibc), | ||
children: "Shield external assets over IBC to Namada", | ||
}, | ||
{ | ||
title: "Internal Shield", | ||
icon: ( | ||
<span className="flex w-full bg-yellow rounded-md"> | ||
<img src={getAssetImageUrl(namadaAsset())} className="w-full" /> | ||
</span> | ||
), | ||
onClick: () => goTo(routes.maspShield), | ||
children: "Shield Assets from your Namada transparent account", | ||
}, | ||
]} | ||
/> | ||
); | ||
}; |
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 { routes } from "App/routes"; | ||
import { wallets } from "integrations"; | ||
import { getAssetImageUrl } from "integrations/utils"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { namadaAsset } from "utils"; | ||
import { SelectOptionModal } from "./SelectOptionModal"; | ||
|
||
type UnshieldAssetsModal = { | ||
onClose: () => void; | ||
}; | ||
|
||
export const UnshieldAssetsModal = ({ | ||
onClose, | ||
}: UnshieldAssetsModal): JSX.Element => { | ||
const navigate = useNavigate(); | ||
const goTo = (url: string): void => { | ||
navigate(url); | ||
onClose(); | ||
}; | ||
|
||
return ( | ||
<SelectOptionModal | ||
title="Unshield Assets" | ||
onClose={onClose} | ||
items={[ | ||
{ | ||
title: "IBC Unshield", | ||
icon: <img src={wallets.keplr.iconUrl} className="w-full" />, | ||
onClick: () => goTo(routes.ibcWithdraw), | ||
children: "Unshield assets over IBC to an IBC chain", | ||
}, | ||
{ | ||
title: "Internal Unshield", | ||
icon: ( | ||
<span className="flex w-full bg-yellow rounded-md"> | ||
<img src={getAssetImageUrl(namadaAsset())} className="w-full" /> | ||
</span> | ||
), | ||
onClick: () => goTo(routes.maspUnshield), | ||
children: | ||
"Unshield assets from your Namada shielded to transparent account", | ||
}, | ||
]} | ||
/> | ||
); | ||
}; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
741fbec
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.
🎉 Published on https://namada-interface-dev.netlify.app as production
🚀 Deployed on https://677d9cd7e3537948aaf903dc--namada-interface-dev.netlify.app