From 8248cd638c8aa04b1881492c06beb028beaba3f2 Mon Sep 17 00:00:00 2001 From: Ahmad Abdolsaheb Date: Thu, 30 Oct 2025 16:31:28 +0300 Subject: [PATCH] feat(client):update accordion map (#63053) --- .../Introduction/components/block-header.tsx | 25 +- .../Introduction/components/block.tsx | 101 +++++++- .../Introduction/components/challenges.tsx | 37 +-- .../components/super-block-accordion.css | 174 ++++++++++++-- .../components/super-block-accordion.tsx | 227 +++++++++++------- .../superblocks/full-stack-developer.json | 1 + e2e/super-block-page.spec.ts | 20 +- 7 files changed, 434 insertions(+), 151 deletions(-) diff --git a/client/src/templates/Introduction/components/block-header.tsx b/client/src/templates/Introduction/components/block-header.tsx index 33376be6bb2..3eeb3a37c4f 100644 --- a/client/src/templates/Introduction/components/block-header.tsx +++ b/client/src/templates/Introduction/components/block-header.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { isEmpty } from 'lodash'; +import { Button } from '@freecodecamp/ui'; import type { BlockLabel as BlockLabelType } from '../../../../../shared-dist/config/blocks'; import { ProgressBar } from '../../../components/Progress/progress-bar'; @@ -19,6 +20,8 @@ interface BlockHeaderProps { isExpanded: boolean; percentageCompleted: number; blockIntroArr?: string[]; + accordion?: boolean; + blockUrl?: string; } function BlockHeader({ @@ -31,27 +34,37 @@ function BlockHeader({ isCompleted, isExpanded, percentageCompleted, - blockIntroArr + blockIntroArr, + accordion, + blockUrl }: BlockHeaderProps): JSX.Element { return ( <>

- +

{isExpanded && !isEmpty(blockIntroArr) && ( diff --git a/client/src/templates/Introduction/components/block.tsx b/client/src/templates/Introduction/components/block.tsx index b54ca48dbc7..32e2a24ade5 100644 --- a/client/src/templates/Introduction/components/block.tsx +++ b/client/src/templates/Introduction/components/block.tsx @@ -31,7 +31,6 @@ import { ChallengesWithDialogues } from './challenges'; import BlockLabel from './block-label'; -import BlockIntros from './block-intros'; import BlockHeader from './block-header'; import '../intro.css'; @@ -74,6 +73,7 @@ interface BlockProps { superBlock: SuperBlocks; t: TFunction; toggleBlock: typeof toggleBlock; + accordion?: boolean; } export class Block extends Component { @@ -113,7 +113,8 @@ export class Block extends Component { challenges, isExpanded, superBlock, - t + t, + accordion = false } = this.props; let completedCount = 0; @@ -199,7 +200,6 @@ export class Block extends Component { )} -