-
Notifications
You must be signed in to change notification settings - Fork 757
Add support for server side styling override for logoUrl, primaryColo… #256
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
Conversation
| /* Global overrides */ | ||
| * { | ||
| font-family: 'Outfit', sans-serif !important; | ||
| font-family: var(--bb-font-family, 'Outfit', sans-serif) !important; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoa, I don't think I've encountered this file before. Why these overrides as opposed to setting this in html {} or body {}?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is going to be rewired by Paul..hopefully this PR will not be needed then..
|
|
||
| // Apply server-side styles if present in beginRendering | ||
| for (const msg of messages) { | ||
| if ('beginRendering' in msg && msg.beginRendering.styles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: I think you can use a nullish coalescing operator here.
| if ('beginRendering' in msg && msg.beginRendering.styles) { | |
| if (msg.beginRendering?.styles) { |
|
|
||
| // 1. Primary Color | ||
| if (styles.primaryColor) { | ||
| root.style.setProperty('--primary-color', styles.primaryColor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we validating these styles anywhere? primaryColor could be like truly any value as far as I can tell.
| this.config = { | ||
| ...this.config, | ||
| heroImage: styles.logoUrl, | ||
| heroImageDark: styles.logoUrl, // Use same for dark mode unless specified otherwise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a way to specify otherwise, right? Should we say we're just going to set this for both until we have a way to specify that?
| "description": "The primary UI color as a hexadecimal code (e.g., '#00BFFF').", | ||
| "pattern": "^#[0-9a-fA-F]{6}$" | ||
| } | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add this here, please also update the specification/0.8/a2ui_protocol.md and the JSON schema in specification/0.8/json. That should be the source of truth for the schema.
In fact, this code should probably be reading those schemas directly and not defining a copy that is likely to get out of date.


…r and font.
Also add back logoUrl to 0.8 schema