Add support for server side styling override for logoUrl, primaryColo…#256
Add support for server side styling override for logoUrl, primaryColo…#256
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.
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.
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.
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.
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.
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.
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