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

added skeleton ui for appbar when status is loading #188

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
9 changes: 8 additions & 1 deletion src/components/Appbar/Appbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import { useEffect, useState } from 'react'
import { FaWallet } from 'react-icons/fa6'
import { useWallet } from '@solana/wallet-adapter-react'
import ProfileDropDown from '../common/ProfileDropDown'
import SkeletonHeader from './SkeletonHeader'

const Appbar = () => {
const { data } = useSession()
const { data, status } = useSession()
const router = useRouter()
const [isMounted, setIsMounted] = useState(false)
const { connected } = useWallet()
Expand Down Expand Up @@ -42,6 +43,10 @@ const Appbar = () => {
}, []);

return (
<div>
{status == 'loading' ?
<><SkeletonHeader/></>
:
<header className="w-screen py-4 border-b md:border-none fixed top-0 left-0 right-0 bg-white md:bg-white/0 z-50 "
style={{ opacity: opacity }}
>
Expand Down Expand Up @@ -141,6 +146,8 @@ const Appbar = () => {
</div>
</div>
</header>
}
</div>
)
}

Expand Down
31 changes: 31 additions & 0 deletions src/components/Appbar/SkeletonHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'
import Skeleton from 'react-loading-skeleton'
import 'react-loading-skeleton/dist/skeleton.css'

export default function SkeletonHeader() {
return (
<header className="w-screen py-4 border-b md:border-none fixed top-0 left-0 right-0 bg-white md:bg-white/0 z-50 ">
<div className="container pl-32 px-4 ">
<div className="flex justify-between items-center md:border md:p-2.5 rounded-xl max-w-2xl lg:max-w-4xl mx-auto md:bg-white/90 md:backdrop:blur-sm">
<div>
<div className="h-10 w-10 rounded-lg inline-flex justify-center items-center">
<Skeleton height={40} width={40} />
</div>
</div>
<div className="hidden md:block">
<nav className="flex gap-8 text-sm">
<Skeleton width={59.06} height={20} />
<Skeleton width={59.06} height={20} />
<Skeleton width={59.06} height={20} />
<Skeleton width={59.06} height={20} />
<Skeleton width={59.06} height={20} />
</nav>
</div>
<div className="flex gap-4 items-center">
<Skeleton height={40} width={104} />
</div>
</div>
</div>
</header>
)
}