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.
feat: add github contributors (#1004)
- Loading branch information
Showing
9 changed files
with
116 additions
and
29 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
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
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
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,63 @@ | ||
import { CodeContributorsAction } from './LandingCTA' | ||
import { SectionContainer, Width } from './ui/SectionContainer' | ||
|
||
const url = 'https://raw.githubusercontent.com/OpenBeta/open-tacos/develop/.all-contributorsrc' | ||
|
||
/** | ||
* Abbreviated GH profile | ||
*/ | ||
interface GithubProfile { | ||
login: string | ||
name: string | ||
avatar_url: string | ||
profile: string | ||
contributions: string[] | ||
} | ||
/** | ||
* List code contributors & volunteers by loading contributor list | ||
* managed by all-contributors bot. | ||
*/ | ||
export const Volunteers: React.FC = async () => { | ||
const res = await fetch(url, { cache: 'no-store' }) | ||
const { contributors }: { contributors: GithubProfile[] } = await res.json() | ||
return ( | ||
<SectionContainer | ||
width={Width.compact} | ||
className='border rounded-box bg-base-200/20' | ||
header={ | ||
<div className='flex items-center gap-6'> | ||
<h2 className='text-base-content'>Volunteers</h2> | ||
<span className='mt-0.5 text-sm'>Total: {new Intl.NumberFormat().format(contributors.length)}</span> | ||
</div> | ||
} | ||
> | ||
<div className='mb-8 max-w-lg'> | ||
As an open source project, OpenBeta's success is thanks to a diverse group of volunteer contributors, many of whom are not even rock climbers. We deeply appreciate their vital role in shaping OpenBeta. | ||
</div> | ||
<div className='columns-3xs gap-x-4'> | ||
{contributors.reverse().map(profile => <Profile key={profile.login} {...profile} />)} | ||
</div> | ||
<div className='pt-8 lg:pt-12 flex items-center gap-6'> | ||
<CodeContributorsAction /> | ||
</div> | ||
</SectionContainer> | ||
) | ||
} | ||
|
||
const Profile: React.FC<GithubProfile> = ({ | ||
name, | ||
/* eslint-disable-next-line */ | ||
avatar_url, | ||
login | ||
}) => ( | ||
<a | ||
className='flex items-center gap-2 mb-4 rounded-box overflow-hidden border w-fit bg-base-100 shadow' | ||
href={`https://github.com/${login}`} | ||
> | ||
<div className='avatar'> | ||
<div className='w-8 rounded-box'> | ||
<img src={avatar_url} alt={name} /> | ||
</div> | ||
</div> | ||
<div className='text-sm uppercase text-base-content pr-4'>{name}</div> | ||
</a>) |
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 |
---|---|---|
@@ -1,15 +1,25 @@ | ||
import { ReactNode } from 'react' | ||
import clx from 'classnames' | ||
|
||
export enum Width { | ||
wide = '2xl:p-0', | ||
compact = 'xl:p-10' | ||
} | ||
|
||
interface Props { | ||
header: ReactNode | ||
children: ReactNode | ||
className?: string | ||
width?: Width | ||
} | ||
export const SectionContainer: React.FC<Props> = ({ header, children }) => { | ||
return ( | ||
<section className='block w-full px-4 2xl:px-0 mx-auto max-w-5xl xl:max-w-7xl'> | ||
{header} | ||
<hr className='mb-6 border-2 border-base-content' /> | ||
{children} | ||
</section> | ||
) | ||
} | ||
|
||
/** | ||
* Reusable wide-screen container for root page | ||
*/ | ||
export const SectionContainer: React.FC<Props> = ({ header, children, className = '', width = Width.wide }) => ( | ||
<section className={clx('block w-full p-4 mx-auto max-w-5xl xl:max-w-7xl', width, className)}> | ||
{header} | ||
<hr className='mb-6 border-2 border-base-content' /> | ||
{children} | ||
</section> | ||
) |
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
b1421c0
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.
Successfully deployed to the following URLs:
open-tacos – ./
www.openbeta.io
open-tacos-openbeta-dev.vercel.app
tacos.openbeta.io
openclimbmap.com
openbeta.io
open-tacos-git-develop-openbeta-dev.vercel.app