Skip to content

Commit

Permalink
feat: implement universal grid refs #116
Browse files Browse the repository at this point in the history
  • Loading branch information
jeangovil committed Oct 10, 2023
1 parent 49bb347 commit cdbe636
Show file tree
Hide file tree
Showing 13 changed files with 643 additions and 101 deletions.
70 changes: 38 additions & 32 deletions packages/docusaurus-playground/docs/community.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,46 @@ title: Join the community
---

import { Community } from '../../logos-docusaurus-theme/src/client/components/mdx'
import { SocialCard, Grid } from '@site/src/components/mdx'

# Join the community

Welcome to the Waku community! Whether you are interested in building with Waku, contributing to the network, expanding your knowledge, or staying abreast of our progress, we have something for everyone.

<Community
items={[
{
type: 'x',
link: 'https://discord.gg/2NXGrsqmDq',
linkLabel: 'Follow us on X',
},
{
type: 'discord',
logoSrcDark: '/icons/discord.svg',
link: 'https://discord.gg/2NXGrsqmDq',
linkLabel: 'Join the community on Discord',
},
{
type: 'telegram',
logoSrcDark: '/icons/discord.svg',
link: 'https://discord.gg/2NXGrsqmDq',
linkLabel: 'Jump in the conversation on Telegram',
},
{
logoSrcDark: '/icons/discord.svg',
link: 'https://discord.gg/2NXGrsqmDq',
linkLabel:
'Share your thoughts on the latest research on the Vac research forum',
},
{
type: 'github',
link: 'https://discord.gg/2NXGrsqmDq',
linkLabel: 'Contribute to Github',
},
]}
/>
<Grid xs={{ cols: 1, gap: '1rem' }} md={{ cols: 2 }}>
<Grid.Item xs={1}>
<SocialCard
logoSrcDark="/icons/x.svg"
href="https://discord.gg/2NXGrsqmDq"
description="Follow us on X"
/>
</Grid.Item>
<Grid.Item xs={1}>
<SocialCard
logoSrcDark="/icons/discord-white.svg"
href="https://discord.gg/2NXGrsqmDq"
description="Join the community on Discord"
/>
</Grid.Item>
<Grid.Item xs={1}>
<SocialCard
logoSrcDark="/icons/telegram-white.svg"
href="https://discord.gg/2NXGrsqmDq"
description="Jump in the conversation on Telegram"
/>
</Grid.Item>
<Grid.Item xs={1}>
<SocialCard
logoSrcDark="/icons/discord.svg"
href="https://discord.gg/2NXGrsqmDq"
description="Share your thoughts on the latest research on the Vac research forum"
/>
</Grid.Item>
<Grid.Item xs={1}>
<SocialCard
logoSrcDark="/icons/github.svg"
href="https://discord.gg/2NXGrsqmDq"
description="Contribute to Github"
/>
</Grid.Item>
</Grid>
146 changes: 80 additions & 66 deletions packages/docusaurus-playground/src/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
Showcase,
HeroInfo,
Box,
Grid,
ProfileCard,
ProfileCards,
} from '../components/mdx'

Expand Down Expand Up @@ -89,72 +91,84 @@ import {
href="/about/team"
target="_self"
/>
<ProfileCards
items={[
{
name: 'Jeremy',
githubUsername: 'jeremyjeremyjeremy',
githubLink: 'https://github.com/acid-info',
discordUsername: 'jeremyjeremyjeremy#0001',
discordLink: 'https://discord.gg/2NXGrsqmDq',
},
{
name: 'Dimitriy',
imgSrc:
'https://statusim.bamboohr.com/employees/photos/?h=297aeedfad6fed82ed60a93a9d850762',
githubUsername: 'dimitriy',
githubLink: 'https://github.com/acid-info',
discordUsername: 'dimitriy#0001',
discordLink: 'https://discord.gg/2NXGrsqmDq',
},
{
name: 'Slava',
imgSrc:
'https://statusim.bamboohr.com/employees/photos/?h=c9028ddcd6da2b7b0aaaf6fabbad7b31',
githubUsername: 'slava',
githubLink: 'https://discord.gg/2NXGrsqmDq',
},
{
name: 'Eric',
imgSrc:
'https://statusim.bamboohr.com/employees/photos/?h=a620c567ee3da938757bb0a43eda4ec9',
discordUsername: 'eric#0001',
discordLink: 'https://discord.gg/2NXGrsqmDq',
},
{
name: 'Tomas',
imgSrc:
'https://statusim.bamboohr.com/employees/photos/?h=8f6066f7e4b7517702c86d85f3ad828d',
},
{
name: 'Adam',
imgSrc:
'https://statusim.bamboohr.com/employees/photos/?h=5edf032c2d62576d36090cf09b5939e5',
githubUsername: 'adam',
githubLink: 'https://github.com/acid-info',
discordUsername: 'adam#0001',
discordLink: 'https://discord.gg/2NXGrsqmDq',
},
{
name: 'Ben',
imgSrc:
'https://statusim.bamboohr.com/employees/photos/?h=406fd339da77e69aeef5f357ece3ff3d',
githubUsername: 'ben',
githubLink: 'https://github.com/acid-info',
discordUsername: 'ben#0001',
discordLink: 'https://discord.gg/2NXGrsqmDq',
},
{
name: 'Leo',
imgSrc:
'https://statusim.bamboohr.com/employees/photos/?h=4d6fcc7c245ca327414ab4d282b509f2',
githubUsername: 'leo',
githubLink: 'https://github.com/acid-info',
discordUsername: 'leo#0001',
discordLink: 'https://discord.gg/2NXGrsqmDq',
},
]}
/>
<Box top={{ xs: 40, md: 80 }} bottom={{ xs: 40, md: 80 }}>
<Grid
xs={{ cols: 3, gap: '1rem', wrap: false }}
md={{ cols: 4, gap: '1rem', wrap: true }}
>
<Grid.Item sm={1}>
<ProfileCard
name="Jeremy"
githubUsername="jeremyjeremyjeremy"
githubLink="https://github.com/acid-info"
discordUsername="jeremyjeremyjeremy#0001"
discordLink="https://discord.gg/2NXGrsqmDq"
/>
</Grid.Item>
<Grid.Item sm={1}>
<ProfileCard
name="Dimitriy"
imgSrc="https://statusim.bamboohr.com/employees/photos/?h=297aeedfad6fed82ed60a93a9d850762"
githubUsername="dimitriy"
githubLink="https://github.com/acid-info"
discordUsername="dimitriy#0001"
discordLink="https://discord.gg/2NXGrsqmDq"
/>
</Grid.Item>
<Grid.Item sm={1}>
<ProfileCard
name="Slava"
imgSrc="https://statusim.bamboohr.com/employees/photos/?h=c9028ddcd6da2b7b0aaaf6fabbad7b31"
githubUsername="slava"
githubLink="https://discord.gg/2NXGrsqmDq"
/>
</Grid.Item>
<Grid.Item sm={1}>
<ProfileCard
name="Eric"
imgSrc="https://statusim.bamboohr.com/employees/photos/?h=a620c567ee3da938757bb0a43eda4ec9"
discordUsername="eric#0001"
discordLink="https://discord.gg/2NXGrsqmDq"
/>
</Grid.Item>
<Grid.Item sm={1}>
<ProfileCard
name="Tomas"
imgSrc="https://statusim.bamboohr.com/employees/photos/?h=8f6066f7e4b7517702c86d85f3ad828d"
/>
</Grid.Item>
<Grid.Item sm={1}>
<ProfileCard
name="Adam"
imgSrc="https://statusim.bamboohr.com/employees/photos/?h=5edf032c2d62576d36090cf09b5939e5"
githubUsername="adam"
githubLink="https://github.com/acid-info"
discordUsername="adam#0001"
discordLink="https://discord.gg/2NXGrsqmDq"
/>
</Grid.Item>
<Grid.Item sm={1}>
<ProfileCard
name="Ben"
imgSrc="https://statusim.bamboohr.com/employees/photos/?h=406fd339da77e69aeef5f357ece3ff3d"
githubUsername="ben"
githubLink="https://github.com/acid-info"
discordUsername="ben#0001"
discordLink="https://discord.gg/2NXGrsqmDq"
/>
</Grid.Item>
<Grid.Item sm={1}>
<ProfileCard
name="Leo"
imgSrc="https://statusim.bamboohr.com/employees/photos/?h=4d6fcc7c245ca327414ab4d282b509f2"
githubUsername="leo"
githubLink="https://github.com/acid-info"
discordUsername="leo#0001"
discordLink="https://discord.gg/2NXGrsqmDq"
/>
</Grid.Item>
</Grid>
</Box>
</Box>

<Box top={{ xs: 144, lg: 216 }}>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { THEME_BREAKPOINTS } from '@acid-info/lsd-react'
import { css } from '@emotion/react'
import styled from '@emotion/styled'
import clsx from 'clsx'
import React from 'react'
import { lsdUtils } from '../../../lib/lsd.utils'
import { GridItem } from './GridItem'

export type GridProps = React.ComponentProps<typeof GridRoot> & {}

export const Grid: { Item: typeof GridItem } & React.FC<GridProps> = ({
children,
...props
}) => {
return (
<GridRoot {...props} className={clsx(props.className, 'hidden-scrollbar')}>
{children}
</GridRoot>
)
}

Grid.Item = GridItem

type GridBreakpointProps = {
cols?: number
wrap?: boolean
gap?: string | number
}

const GridRoot = styled.div<{
xs?: GridBreakpointProps
sm?: GridBreakpointProps
md?: GridBreakpointProps
lg?: GridBreakpointProps
xl?: GridBreakpointProps
}>`
width: 100%;
overflow: hidden;
display: grid;
gap: var(--grid-gap);
grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
${(props) =>
THEME_BREAKPOINTS.map((key) => {
if (!props[key]) return null
const bp = props[key] as GridBreakpointProps
return lsdUtils.responsive(
props.theme as any,
key,
'up',
)(css`
${typeof bp.cols !== 'undefined' &&
`
--grid-cols: ${bp.cols};
`}
${typeof bp.gap !== 'undefined' &&
`
--grid-gap: ${bp.gap};
`}
${(typeof bp.wrap === 'undefined' || bp.wrap === true) &&
`
display: grid;
flex-wrap: unset;
overflow-x: unset;
overflow-y: unset;
scroll-snap-type: unset;
`}
${typeof bp.wrap !== 'undefined' &&
bp.wrap === false &&
`
display: flex;
flex-wrap: nowrap;
overflow-x: scroll;
overflow-y: hidden;
scroll-snap-type: x mandatory;
`}
`)
})}
`
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import clsx from 'clsx'
import React from 'react'
import styled from '@emotion/styled'
import { THEME_BREAKPOINTS } from '@acid-info/lsd-react'
import { lsdUtils } from '../../../lib/lsd.utils'
import { css } from '@emotion/react'

export type GridItemProps = React.ComponentProps<typeof Root> & {}

export const GridItem: React.FC<GridItemProps> = ({ children, ...props }) => {
return (
<Root {...props} className={clsx(props.className)}>
{children}
</Root>
)
}

const Root = styled.div<{
xs?: number
sm?: number
md?: number
lg?: number
xl?: number
}>`
${(props) =>
THEME_BREAKPOINTS.map((key) => {
if (!props[key]) return null
const bp = props[key] as number
return lsdUtils.responsive(
props.theme as any,
key,
'up',
)(css`
grid-column: span ${bp};
flex-basis: calc(100% / var(--grid-cols) * ${bp});
`)
})}
`
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Grid'
export * from './GridItem'

0 comments on commit cdbe636

Please sign in to comment.