import { IconProps } from 'phosphor-react' import { assignInlineVars } from '@vanilla-extract/dynamic' import { ForwardRefExoticComponent, RefAttributes } from 'react' import { Link } from '@remix-run/react' import { isStringGuard } from '~/helpers/guards' import { useIsDarkTheme } from '~/hooks/useIsDarkTheme' import { Button } from '../Buttons/Button' import { Copy } from '../Text/Copy' import { GradientHeader } from '../Text/GradientHeader' import { Heading } from '../Text/Heading' import clsx from 'clsx' import { backgroundTile, colsVar, grid, iconWrapper, navSection, tile, tileButton, tileCanHover, tileCopy, } from './NavigationGrid.css' export interface Tile { href: string label: string description: string comingSoon?: boolean isExternal?: boolean Icon?: | ForwardRefExoticComponent> | string } interface NavigationGridProps { tiles: Tile[] cols?: number subheading?: string heading?: string smallTiles?: boolean className?: string } export const NavigationGrid = ({ tiles, cols = 2, subheading, heading, smallTiles = false, className, }: NavigationGridProps) => { return (
{subheading ? ( {subheading} ) : null} {heading ? ( {heading} ) : null}
{tiles.map(tile => ( ))}
) } interface NavigationItemProps extends Tile { variant: 'small' | 'large' } const NavigationItem = ({ label, href, description, comingSoon = false, isExternal = false, variant = 'large', Icon, }: NavigationItemProps) => { const canHover = Boolean(!comingSoon) const isDarkMode = useIsDarkTheme() const renderTile = () => ( {Icon && isStringGuard(Icon) ? ( {Icon} ) : Icon && !isStringGuard(Icon) ? ( ) : null} {label} {description} {variant === 'large' ? ( ) : null} ) if (comingSoon) { return renderTile() } if (isExternal) { return ( {renderTile()} ) } return {renderTile()} }