Commit 06436ff
authored
Migrate batch 1 components from BEM to CSS Modules (#2014)
* feat: migrate batch 1 components from BEM to CSS Modules
Migrate 8 components from BEM to CSS Modules:
- button (7 BEM files -> 1 module)
- dropdown (7 BEM files -> 1 module)
- thread (3 BEM files -> 1 module)
- auth-panel (2 BEM files -> 1 module)
- dropdown-item, list-comments, subscribe-by-rss, settings (from batch 0 PR #2013)
Consolidates 19 BEM CSS files into 8 CSS Module files. Uses clsx for
conditional class composition, replacing bem-react-helper's b() calls.
Class naming follows the established convention: BEM block = .root,
elements = camelCase, modifiers = camelCase.
Visual regression verification on built artefacts:
- remark.css: 43,779 -> 43,299 bytes (480 bytes smaller)
- last-comments.css: 18,792 -> 18,776 bytes (16 bytes smaller)
- remark.js: 256,709 -> 304,837 bytes (48KB larger, expected: CSS Module
classname mappings now live in JS instead of plain strings)
- Dark theme: pixel-identical (zero difference)
- Light theme: pixel-identical (0.21% diff is the native demo page
"Toggle theme" button, not any remark42 widget element)
Also updates CLAUDE.md CSS guideline to reflect the migration status.
* Migrate remaining BEM components to CSS Modules (final batch)
Migrate the last 4 BEM components to CSS Modules, completing the
migration and removing bem-react-helper from the project entirely.
Components migrated:
- subscribe-by-email (1 BEM CSS file -> 1 module)
- comment-form + markdown-toolbar (20 BEM CSS files -> 2 modules)
- comment (19 BEM CSS files -> expanded existing module)
- root (10 BEM CSS files -> expanded existing module)
Consolidates ~50 BEM CSS files into 4 new + 2 expanded CSS Module files.
Removes bem-react-helper dependency — all components now use clsx for
conditional class composition.
Dead CSS cleanup during migration:
- Orphaned comment-actions selectors in comment theme CSS (already migrated)
- Dead BEM modifiers: comment_disabled, comment_pinned, comment_guest
- Dead element: comment__user-id (CSS existed but never used in TSX)
- Dead button type classes: comment-form__button_type_preview/_send
- Dead mix values: auth-email-login-form__back-button, comment-form__email-dropdown
Key implementation details:
- comment_highlighting stays global via :global() (imperatively added by classList)
- Bare .dark/.light theme class preserved on root wrapper (8+ modules depend on it)
- raw-content.css kept as global utility CSS (syntax highlighting)
Visual regression verification on built artefacts:
- remark.css: 43,779 -> 36,106 bytes (-17.5%)
- last-comments.css: 18,792 -> 13,955 bytes (-25.7%)
- remark.js: 256,709 -> 253,637 bytes (-1.2%)
- last-comments.js: 121,726 -> 120,795 bytes (-0.8%)
- Total: 441,006 -> 424,493 bytes (-3.7%)
- Screenshot comparison: pixel-identical across light/dark themes1 parent b888a53 commit 06436ff
File tree
105 files changed
+1519
-1288
lines changed- docs/plans/completed
- frontend
- apps/remark42
- app/components
- auth-panel
- __column
- button
- _kind
- _link
- _primary
- _secondary
- _size
- _large
- _middle
- _theme/_dark
- comment-form
- __actions
- __button
- _type
- _preview
- _send
- __control-panel
- __counter
- __error
- __field-wrapper
- __field
- __markdown-link
- __markdown
- __preview-wrapper
- __preview
- __rss
- __subscribe-by-email
- _simple
- _theme
- _dark
- _light
- markdown-toolbar-icons
- comment
- __body
- __info
- __input
- __status
- __text
- __time
- __user-id
- __username
- _collapsed
- _editing
- _replying
- _theme
- _dark
- _light
- _useless
- _view
- _admin
- _preview
- _user
- dropdown
- __content
- __items
- __item
- __title
- _active
- _theme
- _dark
- _light
- root
- __copyright
- __input
- __pinned-comments
- __pinned-comment
- __preloader
- __threads
- __thread
- _theme
- _dark
- _light
- thread
- _theme_dark
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
105 files changed
+1519
-1288
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
0 commit comments