Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Animate shield all banner #1118

Merged
merged 4 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/namadillo/src/App/AccountOverview/AccountOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export const AccountOverview = (): JSX.Element => {

{showSidebar &&
(maspEnabled ?
<ShieldAllBanner />
<aside>
<ShieldAllBanner />
</aside>
: <aside className="bg-black rounded-sm">
<MainnetRoadmap />
</aside>)}
Expand Down
290 changes: 290 additions & 0 deletions apps/namadillo/src/App/Assets/ShieldedParty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 27 additions & 10 deletions apps/namadillo/src/App/Sidebars/ShieldAllBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { ActionButton } from "@namada/components";
import svgImg from "App/Assets/ShieldedParty.svg";
import TransferRoutes from "App/Transfer/routes";
import { useState } from "react";
import { Link } from "react-router-dom";
import { twMerge } from "tailwind-merge";

export const ShieldAllBanner = (): JSX.Element => {
const [isAnimating, setIsAnimating] = useState(false);

return (
<div
className={twMerge(
Expand All @@ -11,17 +16,29 @@ export const ShieldAllBanner = (): JSX.Element => {
"p-3"
)}
>
<div className="w-[145px] h-[145px] bg-white">img</div>
<ActionButton
href={TransferRoutes.shieldAll().url}
className="max-w-[160px]"
size="sm"
backgroundColor="black"
textColor="yellow"
backgroundHoverColor="yellow"
<img
className="h-[145px] w-full"
// hover effect with :target for external loaded svg with <img>
// https://developer.mozilla.org/en-US/docs/Web/CSS/:target
// https://gist.github.com/LeaVerou/5198257
src={`${svgImg}${isAnimating ? "#hover " : ""}`}
/>
<Link
to={TransferRoutes.shieldAll().url}
onMouseEnter={() => setIsAnimating(true)}
onMouseLeave={() => setIsAnimating(false)}
>
Shield All Assets
</ActionButton>
<ActionButton
as="div"
className="max-w-[160px]"
size="sm"
backgroundColor="black"
textColor="yellow"
backgroundHoverColor="yellow"
>
Shield All Assets
</ActionButton>
</Link>
</div>
);
};
Loading