Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIE-120 Replace colors with useThemeFromContext in ErrorView and dependants. #4611

Merged
merged 11 commits into from
Mar 15, 2024

Conversation

evrii
Copy link
Contributor

@evrii evrii commented Jan 24, 2024

Jira Ticket: UIE-120

Summary of changes:

What

  • Replaced ErrorView colors usages with useThemeFromContext.
  • Needed to do the same for the components importing the style

Why

Testing strategy

@evrii evrii requested review from a team as code owners January 24, 2024 21:34
@@ -15,7 +14,6 @@ export const styles = {
},
jsonFrame: {
padding: '0.5rem',
backgroundColor: colors.light(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since useThemeFromContext is a hook, it needs to be used in a component. Is there any better way of moving backgroundColor out of style and into inline.

Copy link
Contributor

Choose a reason for hiding this comment

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

my thought would be to change styles here to be a function that accepts the colors object as an argument and returns the desired style props object..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oooh, I like that. Let me see if I can put something together.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh nice, this was my only feedback and it looks like you're already on top of it

Copy link
Contributor

@cjllanwarne cjllanwarne left a comment

Choose a reason for hiding this comment

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

No objection to the change itself. The repeated inline use of the same background color raised a little flag

@@ -45,7 +46,7 @@ const ErrorView = ({ error }) => {
return h(Fragment, [
json.message && div({ style: { marginBottom: '1rem' } }, [json.message]),
div({ style: { fontWeight: 600, marginBottom: '0.5rem' } }, ['Full error:']),
div({ style: styles.jsonFrame }, [JSON.stringify(json, null, 2)]),
div({ style: { ...styles.jsonFrame, backgroundColor: colors.light() } }, [JSON.stringify(json, null, 2)]),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this backgroundColor a change or just a refactoring of where it comes from?

Copy link
Contributor

Choose a reason for hiding this comment

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

and I guess, is there a reason for attaching it directly to the component instead of making it part of a style (or indeed, the jsonFrame style given the updates below too)?

@evrii evrii marked this pull request as ready for review January 26, 2024 15:59
Copy link

sonarcloud bot commented Jan 26, 2024

Copy link
Contributor

@msilva-broad msilva-broad left a comment

Choose a reason for hiding this comment

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

looks great.

@evrii evrii requested a review from aednichols February 2, 2024 18:48
Copy link

sonarcloud bot commented Mar 15, 2024

Merged via the queue into dev with commit 9b5d671 Mar 15, 2024
9 checks passed
@evrii evrii deleted the eric/updateErrorViewColors branch March 15, 2024 18:34
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.

5 participants