Skip to content

feat: add CodeBlock component with transition enhancements (#519)#659

Merged
RUKAYAT-CODER merged 5 commits into
rinafcode:mainfrom
temi-Dee:feat/code-block-transition-519
Jun 1, 2026
Merged

feat: add CodeBlock component with transition enhancements (#519)#659
RUKAYAT-CODER merged 5 commits into
rinafcode:mainfrom
temi-Dee:feat/code-block-transition-519

Conversation

@temi-Dee

@temi-Dee temi-Dee commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements transition enhancements for the Code Block as described in issue #519.

Changes

  • New src/components/code/CodeBlock.tsx component

Features

  • Copy to clipboard — animated Copy→Check icon swap with 2-second auto-reset
  • Expand/Collapse — smooth max-height CSS transition with a fade-out mask for long code blocks (configurable threshold, default 15 lines)
  • Language badge — reuses existing SyntaxHighlighter component for consistency
  • Accessibilityaria-label, aria-expanded, and focus-visible ring on all interactive elements

Usage

import { CodeBlock } from '@/components/code/CodeBlock';

<CodeBlock code={snippet} language="typescript" collapseThreshold={15} />

Closes #519

@drips-wave

drips-wave Bot commented Jun 1, 2026

Copy link
Copy Markdown

@temi-Dee Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

temi-Dee added 3 commits June 1, 2026 13:25
…#519)

- Copy-to-clipboard with animated Copy→Check icon swap and 2s reset
- Expand/collapse with smooth max-height CSS transition and fade mask
- Language badge via existing SyntaxHighlighter component
- Accessible aria-label, aria-expanded attributes
- Configurable collapseThreshold prop (default: 15 lines)
…nafcode#519)

- Replace hardcoded max-h-[calc(15*1.625rem)] with dynamic inline style
  driven by the collapseThreshold prop
- Add standard maskImage alongside WebkitMaskImage for cross-browser support
- Add 9 unit tests covering render, copy, expand/collapse, and prop behaviour
@temi-Dee
temi-Dee force-pushed the feat/code-block-transition-519 branch from 5384236 to d829523 Compare June 1, 2026 13:26
@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER
RUKAYAT-CODER merged commit d3e7160 into rinafcode:main Jun 1, 2026
4 of 6 checks passed
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.

feature Code Block : Transition Enhancement (Issue 121)

2 participants