Skip to content

[BOOKINGSG-9114][RYN] migrate error-display component#1100

Open
ryan-nguyen-t wants to merge 10 commits intopre-release/v4from
BOOKINGSG-9114/error-display
Open

[BOOKINGSG-9114][RYN] migrate error-display component#1100
ryan-nguyen-t wants to merge 10 commits intopre-release/v4from
BOOKINGSG-9114/error-display

Conversation

@ryan-nguyen-t
Copy link
Copy Markdown

Checklist

  • Migrated the component styles
    • className is chained correctly with clsx
    • User style prop is set as CSS variable
  • Changes follow the project guidelines in CONVENTIONS_V4.md
  • Updated Storybook documentation
    - [ ] Added/updated unit tests
  • Added visual tests
    - [ ] Listed breaking changes

Additional information

Added a global css class named story-background-wrapper to add a background that reflexes the current theme so that the content does not get blended in.

Comment thread src/error-display/helper.ts Outdated
Comment thread src/error-display/error-display.tsx Outdated
@@ -0,0 +1,23 @@
// e2e/nextjs-app/src/app/components/error-display/with-action-button.e2e.tsx
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this comment can be removed

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.

run the prompt against the file again

/test-component-functional review the test spec and refactor the file to match the conventions

await story.init("maintenance");
});

test("Maintenance – renders dateString in description", async ({
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.

this could be part of the unit tests instead

Comment thread e2e/nextjs-app/src/app/globals.css Outdated
Comment on lines +15 to +18
.story-background-wrapper {
padding: 1rem;
background-color: var(--fds-colour-bg);
}
Copy link
Copy Markdown
Contributor

@qroll qroll Apr 16, 2026

Choose a reason for hiding this comment

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

  1. padding is not needed since it's part of the layout
  2. we can hardcode the colour here so that it's independent of the theme
  3. you also probably intended to only apply this in dark mode so you should include the media query for that. the default test is now failing since it always has the dark background
Suggested change
.story-background-wrapper {
padding: 1rem;
background-color: var(--fds-colour-bg);
}
@media (prefers-color-scheme: dark) {
.story-background {
background-color: #000000;
}
}

Comment thread src/error-display/error-display.tsx Outdated
{...updatedAssets.img}
alt=""
data-id="error-display-image"
className={styles.img}
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 should chain the classname here too since the prop accepts all html img attributes

clsx(styles.img, updatedAssets.img.className)

Comment thread stories/error-display/props-table.tsx Outdated
Comment on lines +124 to +137
propTypes: [
`"lifesg"`,
`"bookingsg"`,
`"ccube"`,
`"rbs"`,
`"mylegacy"`,
`"oneservice"`,
`"pa"`,
`"spf"`,
`"a11y-playground"`,
`"sgw-digital-lobby"`,
`"supportgowhere"`,
`"imda"`,
],
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.

can replace with ThemeType

@qroll qroll added the type: chore For technical improvements or refactoring. label Apr 16, 2026
@qroll qroll added this to the v4.0.0-alpha.2 milestone Apr 16, 2026
@ryan-nguyen-t ryan-nguyen-t self-assigned this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: chore For technical improvements or refactoring.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants