-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix vertical spacing in Streamlit reports #7
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
| type SimpleElement = ImmutableMap<string, any> | ||
| type Element = SimpleElement | BlockElement | ||
| interface BlockElement extends List<Element> { } | ||
| type StElement = SimpleElement | BlockElement |
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.
The name Element is confusing, since it is a type that already exists in JS. So I renamed this type to make it clear we're not talking about normal DOM elements.
| class Block extends PureComponent<Props> { | ||
| private renderElements = (width: number): ReactNode[] => { | ||
| const elementsToRender = this.handleEmptyElements() | ||
| const elementsToRender = this.getElements() |
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.
Clearer function name.
| const elementsToRender = this.handleEmptyElements() | ||
| const elementsToRender = this.getElements() | ||
|
|
||
| // Transform Streamlit elements into ReactNodes. |
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 broke this code into functions. No logic change.
| } | ||
|
|
||
| private isStaleElement(element: SimpleElement): boolean { | ||
| private isElementStale(element: SimpleElement): boolean { |
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.
Renamed for clarity.
| .element-container { | ||
| display: block; | ||
| display: flex; | ||
| flex-direction: column; |
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 the vertical spacing fix
| const signatureHtml = <span className="doc-signature">{signature}</span> | ||
| const moduleHtml = <span className="doc-module" key="module">{module}.</span> | ||
| const nameHtml = <span className="doc-name" key="name">{name}</span> | ||
| const signatureHtml = <span className="doc-signature" key="signature">{signature}</span> |
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.
Address React warnings in the JS console.
…pected no return value
* develop: st.map() using deck_gl (streamlit#14) Adding support for if and for to magic (streamlit#12) Fix vertical spacing in Streamlit reports (streamlit#7) Fix streamlit#6: report should loads element by element (was broken since Sidebar PR) (streamlit#9)
Removed customizable strings from ChatComposer to match ChatAudioRecorder. This pattern was over-engineering - no i18n system exists yet and it adds unnecessary complexity. Now uses hard-coded aria-labels directly. Also restored requestAnimationFrame in focusInput after tests proved it's necessary. RAF ensures focus happens after click events fully process, preventing race conditions when transitioning focus from buttons to input. Resolves PR #12834 comment #7 Addresses PR #12834 comment #4
The Sidebar PR accidentally reduced the vertical spacing of Streamlit elements. This fixes that with a one-line CSS change, and then does some small refactors for Block-related readability.