Skip to content

Instantly share code, notes, and snippets.

View glennreyes's full-sized avatar
🎵

Glenn Reyes glennreyes

🎵
View GitHub Profile
@glennreyes
glennreyes / query-response.json
Last active September 20, 2023 15:20
GraphQL Workshop slides snippets
{
"data": {
"viewer": {
"id": "clmrvzzlx000008l6e8a4de9o",
"name": "Glenn",
"posts": [
{
"id": "clmrw16zi000108l619ctafwt",
"message": "I'm excited you're here at the awesome GraphQL Workshop!"
},
@glennreyes
glennreyes / polymorphic-component.tsx
Last active April 3, 2024 21:00
An h1 that can be anything from an h1-h4
import type { ComponentPropsWithoutRef, ElementType } from 'react';
type H1Props<TElementType extends ElementType> = Omit<ComponentPropsWithoutRef<TElementType>, 'className'> & {
as?: Extract<TElementType, 'h1' | 'h2' | 'h3' | 'h4'>;
};
export function H1<TElementType extends ElementType>({ as, ...props }: H1Props<TElementType>) {
const Component = as ?? 'h1';
return <Component className="text-5xl font-extrabold tracking-tight" {...props} />;