generated from taylorbryant/gatsby-starter-tailwind
-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make sure loading skeleton is the same as actual comp
- Loading branch information
viet nguyen
committed
Oct 31, 2023
1 parent
b1421c0
commit 4fee069
Showing
4 changed files
with
58 additions
and
57 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,50 @@ | ||
import { ReactNode } from 'react' | ||
import Link from 'next/link' | ||
import { ArrowRightIcon } from '@heroicons/react/24/outline' | ||
|
||
import { getChangeHistoryServerSide } from '@/js/graphql/contribAPI' | ||
import { ChangesetCard } from '@/components/edit/RecentChangeHistory' | ||
|
||
/** | ||
* Show most recent contributions | ||
*/ | ||
export const LatestContributions: React.FC = async () => { | ||
const history = await getChangeHistoryServerSide() | ||
return ( | ||
<Container> | ||
{history.splice(0, 10).map(changetset => | ||
<ChangesetCard key={changetset.id} changeset={changetset} /> | ||
)} | ||
</Container> | ||
) | ||
} | ||
|
||
/** | ||
* Resuable container for actual and skeleton | ||
*/ | ||
const Container: React.FC<{ children: ReactNode }> = ({ children }) => ( | ||
<section className='px-4 w-full'> | ||
<div className='mt-2 flex items-center justify-between'> | ||
<h3>Latest contributions </h3> | ||
<Link href='/edit' className='text-sm hover:underline'>See more</Link> | ||
</div> | ||
<hr className='mb-6 border-1 border-base-content' /> | ||
<div className='mt-4 flex justify-center flex-row flex-wrap gap-y-10 gap-x-4'> | ||
{children} | ||
</div> | ||
<div className='flex justify-center py-10'> | ||
<Link href='/edit' className='btn btn-sm btn-outline'>See more <ArrowRightIcon className='w-4 h-4' /></Link> | ||
</div> | ||
</section> | ||
) | ||
|
||
/** | ||
* Loading skelton | ||
*/ | ||
export const LatestContributionsSkeleton: React.FC = () => { | ||
return ( | ||
<Container> | ||
{[1, 2, 3, 4, 5].map(item => <div key={item} className='w-full bg-base-200/20 h-36 rounded-box' />)} | ||
</Container> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
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