Skip to content

Commit

Permalink
add: skeleton member card
Browse files Browse the repository at this point in the history
  • Loading branch information
kiko-g committed Jul 24, 2022
1 parent 2e9ff15 commit c67a97f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
26 changes: 26 additions & 0 deletions src/components/registry/MemberCardSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react'

const MemberCardSkeleton = () => (
<div className="member-card">
<aside className="relative rounded-l-xl md:rounded-xl">
<div className="h-64 w-full rounded-xl animate-pulse bg-lightish dark:bg-darkish shadow lg:h-48 lg:w-72"></div>
</aside>

<section className="relative flex w-auto grow flex-col justify-between space-y-6 rounded-r-xl px-1 py-1 text-base font-normal lg:h-auto lg:max-h-full lg:w-3/4 lg:py-0 lg:pl-4 lg:pr-0">
<div className="flex h-48 flex-col justify-between">
<span className="bg-lightish dark:bg-darkish w-36 h-6 rounded animate-pulse" />
<span className="bg-lightish dark:bg-darkish w-24 h-4 rounded animate-pulse" />
<span className="bg-lightish dark:bg-darkish w-12 h-4 rounded animate-pulse" />
<span className="bg-lightish dark:bg-darkish w-48 h-16 rounded animate-pulse" />

<div className="flex items-center gap-2">
<button className="action bg-lightish dark:bg-darkish h-8 w-24 animate-pulse"></button>
<button className="action bg-lightish dark:bg-darkish h-8 w-24 animate-pulse"></button>
<button className="action bg-lightish dark:bg-darkish h-8 w-24 animate-pulse"></button>
</div>
</div>
</section>
</div>
)

export default MemberCardSkeleton
3 changes: 2 additions & 1 deletion src/components/registry/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import MemberCard from './MemberCard'
import ClaimIdentity from './ClaimIdentity'
import DataDisclaimer from './DataDisclaimer'
import MemberCardSkeleton from './MemberCardSkeleton'

export { MemberCard, ClaimIdentity, DataDisclaimer }
export { MemberCard, ClaimIdentity, DataDisclaimer, MemberCardSkeleton }
6 changes: 4 additions & 2 deletions src/pages/registry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Layout from '../layout'
import Seo from '../components/Seo'
import RegistryAPI from '../api/registry'
import { RegistryEntry } from '../@types'
import { MemberCard, DataDisclaimer } from '../components/registry'
import { MemberCard, DataDisclaimer, MemberCardSkeleton } from '../components/registry'
import '../styles/pages/registry.css'

const RegistryPage = () => {
Expand Down Expand Up @@ -31,12 +31,14 @@ const RegistryPage = () => {
</header>

<div className="member-list">
{members.map((member: RegistryEntry, memberIdx: number) => (
{members.length !== 0 ? members.map((member: RegistryEntry, memberIdx: number) => (
<MemberCard
key={`member-${memberIdx}`}
member={member}
updateMembers={updateMembers}
/>
)) : Array(4).fill(0).map((_, idx) => (
<MemberCardSkeleton />
))}
</div>
</main>
Expand Down
2 changes: 2 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ module.exports = {
dark: '#242731',
darker: '#1e2028',
darkest: '#1a1c23',
darkish: '#333640',
light: '#f2f4f7',
lighter: '#f7f7f7',
lightest: '#fcfcfc',
lightish: '#ebedf0',
navydark: '#1a202c',
},
maxWidth: {
Expand Down

0 comments on commit c67a97f

Please sign in to comment.