Skip to content

feat: rebuild component-library using Vite#866

Merged
michael-odonovan merged 130 commits into
masterfrom
4973_CL_rebuild
Jul 2, 2026
Merged

feat: rebuild component-library using Vite#866
michael-odonovan merged 130 commits into
masterfrom
4973_CL_rebuild

Conversation

@michael-odonovan

@michael-odonovan michael-odonovan commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

PR description

What is it doing?

Rebuild using Vite and native React/Javascript functionality.
Moves this repo off dependency on an unmaintained package and updates to React 18.

Why is this required?

Maintenance / Security updates.

link to Jira ticket:

https://comicrelief.atlassian.net/browse/ENG-4973

Quick Checklist:

  • My PR title follows the Conventional Commit spec.

  • I have filled out the PR description as per the template above.

  • I have added tests to cover new or changed behaviour.

  • I have updated any relevant documentation.

Important! - lastly, make sure to squash merge...

@michael-odonovan michael-odonovan changed the title feat: rebuild of component library / import of component-library-26 POC feat: rebuild component-library using Vite May 2, 2026
@AndyEPhipps

Copy link
Copy Markdown
Contributor

Yeha, I saw seeing issues with icons too, think that 'mock.asset' thing is likely the cause; don't fully understand what that is or how its supposed to be used yet, but will pick over it next week.

Review list so far, just in case it's useful, will add to this later:

  • Ambient Video missing play/pause icon missing
  • Checkbox icon missing
  • Input example formatting/layout (not a big deal, can totally be done later in another PR)
  • Select icon missing
  • Select background colour changed

@KrupaPammi

Copy link
Copy Markdown
Contributor

Along with the issues mentioned above, I noticed the below one:

The LogoLinked component seems to be missing under the Molecules section in the localhost build. I can see it in the current master envt here: https://cr-component-library.netlify.app/#logolinked, but it doesn’t appear in this branch.

@KrupaPammi

Copy link
Copy Markdown
Contributor

@michael-odonovan tested the fixes, all working as expected. Just a reminder of what Andy mentioned above on

Input example formatting/layout (not a big deal, can totally be done later in another PR)

But it can be done in another PR.

Great work on this, looking really good.

@AndyEPhipps

AndyEPhipps commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@michael-odonovan tested the fixes, all working as expected. Just a reminder of what Andy mentioned above on

Input example formatting/layout (not a big deal, can totally be done later in another PR)

But it can be done in another PR.

Great work on this, looking really good.

Absolutely; this is a mammoth bit of work with a lot of nonsense to deal with and you've done us all proud.

Will just sense-check the updated diffs, then suss out that yalc fella you mentioned before and give that a whirl

width: 24px;
height: 24px;
background-image: url(${({ $icon }) => $icon});
background-image: url("${({ $icon }) => $icon}");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ohhhh, that's interesting; nicely sussed - I wonder if that due to the react or the styled-components update, or it's a Vitey thing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I really don't know why it passed previously - maybe to do with React update being stricter.


expect(tree).toMatchInlineSnapshot(`
.c0 {
display: -webkit-inline-box;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We've still got autoprefixer in the package.json but let's just leave it in for sanity and figure out the config in the next PR

@@ -175,8 +171,6 @@ exports[`renders Picture with flat props correctly 1`] = `

<div
className="c0 lazyload"
height="100%"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Still not fully sure about these changes to Picture (no doubt due to the Transient Props Tango), but given that Krupa's already eyeballed everything without flagging, I guess we can leave it for now and revisit if needs be.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Guess we should fix this, the image on PictureOrVideo is getting cut off compared to the master one

image

Master

image

Comment thread src/components/Atoms/Input/InputExample.jsx Outdated
@KrupaPammi

Copy link
Copy Markdown
Contributor

@michael-odonovan Few minor issues that can go in another PR.

  1. Input: Spacing needed between the fields and the text
image

Master

image
  1. Link: Missing grey background on links that shows on master
image

Master

image
  1. Select: Need spacing between the fields and the error messages or text

New build:

image

Same issue on Master too

image
  1. Socialicons: Not sure if this would be the same when we import but the background of socialicons show red on the new build, on master, it has a black background

New build:

image

Master

image
  1. Lookup
    Spacing needed between the field and the search button
image image
  1. PartnerLink: Find out more link is missing on the new build
image
  1. Promo Lower w/Video (autoplay only, white text gradient overlay) - Why doesn't the video autoplay as it says on the label? It plays only when the play icon is clicked. This is on both master and this new build
image
  1. SchoolLookUp: Spacing needed between the field and the error messages. Fix needed on both master and the new build
image
  1. SingleMessage

The copy on single message on the new build is stretched but on master is formatted in the center

image

Master

image

@KrupaPammi

Copy link
Copy Markdown
Contributor

@michael-odonovan @AndyEPhipps Issues 1, 2, 4 and 9 are specific to the new build, other issues are on both new and master. All minor ones which I thought may not affect but flagging just in case.

michael-odonovan and others added 7 commits June 29, 2026 19:14
…er wrapping

The commit 3a1c727 wrapped component examples in ExampleContainer,
changing the DOM structure. Test selectors using nth-child now fail
because labels are no longer direct children of the preview div.

Updates:
- Checkbox: Use page.locator with .nth() to select specific labels instead
  of nth-child selectors that don't match the new nested structure
- ImpactSlider: Fix selectors that assumed linear DOM structure

These changes make selectors more robust and work with the new layout.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Destructure data-testid from rest props so it only goes to the Label element,
not to StyledCheckboxInput. This prevents the same attribute from appearing
on multiple elements, which causes Playwright strict mode errors.

Change:
- Extract data-testid before spreading rest to StyledCheckboxInput
- Only StyledCheckboxInput gets the remaining inputProps (without data-testid)
- Label gets data-testid attribute exclusively

This makes selectors unambiguous: label[data-testid="..."] now resolves to
exactly 1 element instead of 2.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Scope both impact-slider-amount-text AND impact-slider--moneybuy selectors
with their parent ImpactSlider-example to avoid strict mode violations.

Changes:
- All assertions in test 1: scope to [data-testid="ImpactSlider-example-1"]
- All assertions in test 2: scope to [data-testid="ImpactSlider-example-2"]

This ensures when multiple ImpactSlider instances exist on the page,
each selector targets only the elements within the intended example.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@michael-odonovan michael-odonovan merged commit b163083 into master Jul 2, 2026
9 checks passed
@michael-odonovan michael-odonovan deleted the 4973_CL_rebuild branch July 2, 2026 09:21
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 8.74.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants