-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
801 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Grid, H2 } from "@rivet-gg/components"; | ||
import { motion } from "framer-motion"; | ||
import type { ReactNode } from "react"; | ||
import OpenGBMeta from "../../vendor/opengb-modules-meta.json"; | ||
import { ModuleCard } from "./module-card"; | ||
|
||
const FEATURED_MODULES = ["lobbies", "friends", "analytics"]; | ||
|
||
interface FeaturesModulesGridProps { | ||
footer?: ReactNode; | ||
} | ||
|
||
export function FeaturesModulesGrid({ footer }: FeaturesModulesGridProps) { | ||
const modules = OpenGBMeta.categories | ||
.flatMap((category) => category.modules) | ||
.filter((module) => FEATURED_MODULES.includes(module.id)); | ||
|
||
return ( | ||
<motion.section | ||
className="mt-12" | ||
initial={{ opacity: 0 }} | ||
animate={{ opacity: 1 }} | ||
exit={{ opacity: 0 }} | ||
> | ||
<H2 className="my-4 text-base">Extend your game with modules</H2> | ||
|
||
<Grid | ||
columns={{ initial: "1", sm: "3" }} | ||
gap="4" | ||
items="start" | ||
className="my-4" | ||
> | ||
{modules.map((module) => ( | ||
<ModuleCard key={module.id} layoutAnimation={false} {...module} /> | ||
))} | ||
</Grid> | ||
{footer} | ||
</motion.section> | ||
); | ||
} | ||
|
||
export default FeaturesModulesGrid; |
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,97 @@ | ||
import { | ||
type IconPack, | ||
type IconProp, | ||
library, | ||
} from "@fortawesome/fontawesome-svg-core"; | ||
import { fab } from "@fortawesome/free-brands-svg-icons"; | ||
import { fas } from "@fortawesome/pro-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { | ||
Card, | ||
CardDescription, | ||
CardHeader, | ||
CardTitle, | ||
Sheet, | ||
SheetContent, | ||
SheetDescription, | ||
SheetHeader, | ||
SheetTitle, | ||
SheetTrigger, | ||
} from "@rivet-gg/components"; | ||
import { motion } from "framer-motion"; | ||
|
||
const fasFab: IconPack = Object.fromEntries( | ||
Object.entries(fab).map(([iconName, icon]) => [ | ||
iconName, | ||
{ ...icon, prefix: "fas" }, | ||
]), | ||
); | ||
|
||
library.add(fasFab, fas); | ||
|
||
const animationProps = { | ||
initial: { opacity: 0 }, | ||
animate: { opacity: 1 }, | ||
exit: { opacity: 0 }, | ||
}; | ||
|
||
interface ModuleCardProps { | ||
id: string; | ||
name: string; | ||
description: string; | ||
status: string; | ||
icon: string; | ||
layoutAnimation?: boolean; | ||
} | ||
|
||
export function ModuleCard({ | ||
id, | ||
name, | ||
icon, | ||
description, | ||
layoutAnimation = true, | ||
}: ModuleCardProps) { | ||
return ( | ||
<Sheet> | ||
<SheetTrigger asChild> | ||
<Card | ||
className="text-left hover:border-primary transition-colors" | ||
asChild | ||
> | ||
<motion.button | ||
type="button" | ||
className="h-full flex" | ||
{...(layoutAnimation | ||
? { ...animationProps, layout: "position", layoutId: id } | ||
: {})} | ||
> | ||
<CardHeader className="max-w-full"> | ||
<CardTitle> | ||
<FontAwesomeIcon | ||
className="text-primary mb-3 block" | ||
icon={icon as IconProp} | ||
/> | ||
{name} | ||
</CardTitle> | ||
<CardDescription className="break-words"> | ||
{description} | ||
</CardDescription> | ||
</CardHeader> | ||
</motion.button> | ||
</Card> | ||
</SheetTrigger> | ||
<SheetContent className="sm:max-w-[500px]"> | ||
<SheetHeader> | ||
<SheetTitle>{name} in OpenGB Docs</SheetTitle> | ||
<SheetDescription className="-mx-6"> | ||
<iframe | ||
className="w-full h-screen" | ||
src={`https://opengb.dev/modules/${id}/overview`} | ||
title={name} | ||
/> | ||
</SheetDescription> | ||
</SheetHeader> | ||
</SheetContent> | ||
</Sheet> | ||
); | ||
} |
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
Oops, something went wrong.