Skip to content

feat: Detailed code component for longer code examples#3236

Draft
nhivpham wants to merge 9 commits intomainfrom
np-gmt-257
Draft

feat: Detailed code component for longer code examples#3236
nhivpham wants to merge 9 commits intomainfrom
np-gmt-257

Conversation

@nhivpham
Copy link
Contributor

@nhivpham nhivpham commented Jan 20, 2026

Overview

Adds an internal detailed code component for code examples that run longer.

PR Checklist

  • Related to designs:
  • Related to JIRA ticket: GMT-257
  • I have run this code to verify it works
  • This PR includes unit tests for the code change
  • This PR includes testing instructions tests for the code change
  • The alpha package of this PR is passing end-to-end tests in all relevant Codecademy repositories

Testing Instructions

Don't make me tap the sign.

  1. Go to /?path=/docs/organisms-connectedform-connectedform--docs#example-code
  2. View example code preview
  3. Click on code drop down
  4. Close code drop down
  5. Finish and do a celebratory dance

PR Links and Envs

Repository PR Link
Monolith Monolith PR
Mono Mono PR

@nhivpham nhivpham requested a review from a team as a code owner January 20, 2026 18:34
@nhivpham nhivpham marked this pull request as draft January 20, 2026 18:35
@nx-cloud
Copy link

nx-cloud bot commented Jan 20, 2026

View your CI Pipeline Execution ↗ for commit 6f8e4b9


☁️ Nx Cloud last updated this comment at 2026-02-03 09:16:23 UTC

Copy link
Contributor

@LinKCoding LinKCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like what you've done!

I've added some notes to polish up the PR, but would love to hear your thoughts :)
Thanks for taking this on!

export const DetailedCodeButton: React.FC<DetailedCodeButtonProps> = ({
heading,
isExpanded,
language,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider defaulting to tsx

Comment on lines 30 to 33
'& > div': {
borderRadius: 'none',
padding: 0,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this could be omitted and the .docblock-source could get a borderRadius: 'none'

Comment on lines 62 to 64
<Rotation height={16} rotated={isExpanded} width={16}>
<MiniChevronDownIcon aria-hidden size={16} />
</Rotation>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like we should have something more overt to indicate that this button will "show more code"

Or that there is more code to display.

My first thought is to have something shown right under the code snippet that is a TextButton that has ... show more code" that also has the same handleClick`

but would want to hear your thoughts

borderRadius: 'none',
padding: 0,
},
'& .docblock-source': {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also did some styling testing and it seems like targeting the .docblock-source is the most consistent want to apply the styling :\ so that seems to be just the way to do it.

but I think it warrants adding a note for why it has to be done this way.

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 22.22222% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.53%. Comparing base (db9a43b) to head (6f8e4b9).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/gamut/src/DetailedCode/index.tsx 16.66% 20 Missing ⚠️
...amut/src/DetailedCode/DetailedCodeButton/index.tsx 14.28% 6 Missing ⚠️
.../gamut/src/DetailedCode/DetailedCodeBody/index.tsx 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3236      +/-   ##
==========================================
- Coverage   89.78%   88.53%   -1.25%     
==========================================
  Files         361      240     -121     
  Lines        5120     4345     -775     
  Branches     1609     1484     -125     
==========================================
- Hits         4597     3847     -750     
+ Misses        515      490      -25     
  Partials        8        8              
Flag Coverage Δ
main ?
pull-request 88.53% <22.22%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codecademydev
Copy link
Collaborator

📬 Published Alpha Packages:

@codecademy/gamut@68.0.1-alpha.3a9965.0
@codecademy/gamut-kit@0.6.580-alpha.3a9965.0
@codecademy/styleguide@79.0.1-alpha.3a9965.0

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants