1- import { ReactNode } from "react"
1+ import { ReactNode , useState } from "react"
2+ import { clsx } from "clsx"
23
34import { StripesDecoration } from "@/app/conf/_design-system/stripes-decoration"
4- import { Eyebrow } from "@/_design-system/eyebrow"
55import ArrowDownIcon from "@/app/conf/_design-system/pixelarticons/arrow-down.svg?svgr"
66
7+ import { Eyebrow } from "@/_design-system/eyebrow"
8+
79import blurBean from "./learn-blur-bean.webp"
8- import clsx from "clsx "
10+ import { Button } from "@/app/conf/_design-system/button "
911
1012export interface TeaserSectionProps
1113 extends React . HTMLAttributes < HTMLDivElement > {
@@ -32,6 +34,8 @@ export function TeaserSection({
3234 className,
3335 ...rest
3436} : TeaserSectionProps ) {
37+ const [ showingMore , showMore ] = useState ( false )
38+
3539 return (
3640 < section
3741 className = { clsx (
@@ -50,37 +54,51 @@ export function TeaserSection({
5054 { cta }
5155 </ div >
5256 </ header >
53- < ul className = "grid grid-cols-1 justify-stretch gap-4 sm:max-lg:grid-cols-2 lg:gap-8" >
54- { items . map ( ( item , index ) => {
55- return (
56- < TeaserSectionListItem
57- key = { index }
58- number = { index + 1 }
59- title = { item . title }
60- description = { item . description }
61- href = { item . href }
62- section = { item . section }
63- icon = {
64- < img
65- src = { item . icon }
66- width = { 72 }
67- height = { 72 }
68- className = "aspect-square lg:size-[138px]"
69- loading = { index < 2 && firstIconsEager ? "eager" : "lazy" }
70- alt = ""
71- />
72- }
73- />
74- )
75- } ) }
76- </ ul >
57+ < div >
58+ < ul className = "grid grid-cols-1 justify-stretch gap-4 sm:max-lg:grid-cols-2 lg:gap-8" >
59+ { items . map ( ( item , index ) => {
60+ return (
61+ < TeaserSectionListItem
62+ key = { index }
63+ number = { index + 1 }
64+ title = { item . title }
65+ description = { item . description }
66+ href = { item . href }
67+ section = { item . section }
68+ className = { clsx (
69+ ! showingMore &&
70+ "lg:[&:nth-child(n+4)]:hidden [&:nth-child(n+5)]:hidden" ,
71+ ) }
72+ icon = {
73+ < img
74+ src = { item . icon }
75+ width = { 72 }
76+ height = { 72 }
77+ className = "aspect-square lg:size-[138px]"
78+ loading = { index < 2 && firstIconsEager ? "eager" : "lazy" }
79+ alt = ""
80+ />
81+ }
82+ />
83+ )
84+ } ) }
85+ </ ul >
86+ < Button
87+ className = "mt-4 w-full lg:mt-8"
88+ variant = "secondary"
89+ onClick = { ( ) => showMore ( s => ! s ) }
90+ >
91+ Show { ! showingMore ? "more" : "less" }
92+ </ Button >
93+ </ div >
7794 </ section >
7895 )
7996}
8097
8198// https://www.figma.com/design/aPUvZDSxJfYDJtPd7GF2sB/GraphQL.org--Working-File?node-id=6368-6983&t=JE1eYbp6gpQRUILY-4
8299// https://www.figma.com/design/aPUvZDSxJfYDJtPd7GF2sB/GraphQL.org--Working-File?node-id=5830-51637&t=JE1eYbp6gpQRUILY-4
83- interface TeaserSectionListItemProps {
100+ interface TeaserSectionListItemProps
101+ extends React . HTMLAttributes < HTMLLIElement > {
84102 number : number
85103 title : string
86104 description : string
@@ -95,16 +113,18 @@ function TeaserSectionListItem({
95113 icon,
96114 section,
97115 href,
116+ className,
117+ ...rest
98118} : TeaserSectionListItemProps ) {
99119 return (
100- < li className = "flex text-neu-900" >
120+ < li className = { clsx ( "flex text-neu-900" , className ) } { ... rest } >
101121 < a
102122 href = { href }
103- className = "gql-focus-visible grid border border-neu-200 bg-neu-0 transition-colors [grid-template-areas:'icon_header''desc_desc'] [grid-template-columns:72px_1fr] [grid-template-rows:auto_1fr] hover:border-neu-300 hover: ring hover:ring-neu-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 dark:hover:ring-neu-50 lg:[grid-template-areas:'icon_header_header''icon_desc_arrow'] lg:[grid-template-columns:190px_1fr_64px]"
123+ className = "gql-focus-visible grid border border-neu-200 bg-neu-0 transition-colors [grid-template-areas:'icon_header''desc_desc'] [grid-template-columns:72px_1fr] [grid-template-rows:auto_1fr] hover:ring hover:ring-neu-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 dark:border-neu-100 dark:hover:ring-neu-50 lg:[grid-template-areas:'icon_header_header''icon_desc_arrow'] lg:[grid-template-columns:190px_1fr_64px]"
104124 >
105125 < span
106126 className = { clsx (
107- "flex size- [72px] items-center justify-center border-neu-200 p-2 [grid-area:icon] lg:size -[190px]" ,
127+ "flex aspect-square h-full w- [72px] items-center justify-center border-neu-200 p-2 [grid-area:icon] dark:border-neu-100 lg:min-w -[190px]" ,
108128 section === "getting-started" &&
109129 "bg-pri-lighter/10 dark:bg-pri-lighter/5" ,
110130 section === "best-practices" &&
@@ -124,11 +144,11 @@ function TeaserSectionListItem({
124144 </ span >
125145 </ span >
126146
127- < p className = "typography-body-sm text-pretty p-4 text-neu-900 [grid-area:desc] max-lg:typography-body-md max-lg:border-t max-lg:border-neu-200" >
147+ < p className = "typography-body-sm text-pretty p-4 text-neu-900 [grid-area:desc] max-lg:typography-body-md max-lg:border-t max-lg:border-neu-200 dark:max-lg:border-neu-100 " >
128148 { description }
129149 </ p >
130150
131- < span className = "hidden items-center justify-center place-self-end border-l border-t border-neu-200 p-4 [grid-area:arrow] lg:flex" >
151+ < span className = "hidden items-center justify-center place-self-end border-l border-t border-neu-200 p-4 [grid-area:arrow] dark:border-neu-100 lg:flex" >
132152 < ArrowDownIcon className = "size-8 shrink-0 -rotate-90" />
133153 </ span >
134154 </ a >
@@ -141,7 +161,7 @@ export function LearnHeroStripes() {
141161 < div
142162 role = "presentation"
143163 // eslint-disable-next-line tailwindcss/no-contradicting-classname
144- className = "pointer-events-none absolute inset-0 h-[300px] bg-neu-50 [--end-1:#FFF] [--end-2:rgb(255_204_239/.2)] [--start-1:#FFEAF8] [--start-2:hsl(var(--color-sec-lighter))] dark:[--end-1:hsl(var(--color-neu-0))] dark:[--start-1:hsl(var(--color-neu-100))] sm:h-[360px] lg:h-[480px]"
164+ className = "pointer-events-none absolute inset-0 h-[300px] bg-neu-50 [--end-1:#FFF] [--end-2:rgb(255_204_239/.2)] [--start-1:#FFEAF8] [--start-2:hsl(var(--color-sec-lighter))] dark:[--end-1:hsl(var(--color-neu-0))] dark:[--end-2:hsl(var(--color-pri-base)/.1)] dark:[-- start-1:hsl(var(--color-neu-100)/.2)] dark:[--start-2:hsl(var(--color-sec-light)/.1 )] sm:h-[360px] lg:h-[480px]"
145165 style = { {
146166 maskImage : `url(${ blurBean . src } )` ,
147167 WebkitMaskImage : `url(${ blurBean . src } )` ,
0 commit comments