-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: ui.footer #1100
base: main
Are you sure you want to change the base?
feat: ui.footer #1100
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,40 @@ | ||||||||||||||||||||||||||||||
# Footer | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
A footer for a document or section. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
## Example | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
```python | ||||||||||||||||||||||||||||||
from deephaven import ui | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
my_footer = ui.footer("© All rights reserved.") | ||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
## Content | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
The footer component represents a footer that inherits styling from its parent container. It accepts any renderable node, not just strings. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
## Slots | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
`ui.footer` is intended to be used in container components with layouts that provide a slot for `ui.footer` (and other supported elements). These components handle the layout and styling of such elements for you. See [`ui.dialog`](./dialog.md#content) and [`ui.contextual_help`](./contextual_help#example) for more detailed examples. | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
```python | ||||||||||||||||||||||||||||||
from deephaven import ui | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
my_footer_order_example = ui.dialog( | ||||||||||||||||||||||||||||||
ui.heading("Customer Support Request"), | ||||||||||||||||||||||||||||||
ui.content( | ||||||||||||||||||||||||||||||
"We have received your support request and are currently reviewing it. Our team will get back to you soon." | ||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||
ui.footer( | ||||||||||||||||||||||||||||||
"Ticket ID: #123456 | Status: In Progress | Support email: [email protected]" | ||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This example is weird, because we're not using a dialog like a dialog (triggering it and opening it), it's just appearing in a panel.
Suggested change
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
## API reference | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
```{eval-rst} | ||||||||||||||||||||||||||||||
.. dhautofunction:: deephaven.ui.footer | ||||||||||||||||||||||||||||||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
from __future__ import annotations | ||
|
||
from .basic import component_element | ||
from ..elements import Element, NodeType | ||
from .types import ( | ||
AlignSelf, | ||
CSSProperties, | ||
DimensionValue, | ||
JustifySelf, | ||
LayoutFlex, | ||
Position, | ||
) | ||
|
||
|
||
def footer( | ||
*children: NodeType, | ||
flex: LayoutFlex | None = None, | ||
flex_grow: float | None = None, | ||
flex_shrink: float | None = None, | ||
flex_basis: DimensionValue | None = None, | ||
align_self: AlignSelf | None = None, | ||
justify_self: JustifySelf | None = None, | ||
order: int | None = None, | ||
grid_area: str | None = None, | ||
grid_row: str | None = None, | ||
grid_row_start: str | None = None, | ||
grid_row_end: str | None = None, | ||
grid_column: str | None = None, | ||
grid_column_start: str | None = None, | ||
grid_column_end: str | None = None, | ||
margin: DimensionValue | None = None, | ||
margin_top: DimensionValue | None = None, | ||
margin_bottom: DimensionValue | None = None, | ||
margin_start: DimensionValue | None = None, | ||
margin_end: DimensionValue | None = None, | ||
margin_x: DimensionValue | None = None, | ||
margin_y: DimensionValue | None = None, | ||
width: DimensionValue | None = None, | ||
height: DimensionValue | None = None, | ||
min_width: DimensionValue | None = None, | ||
min_height: DimensionValue | None = None, | ||
max_width: DimensionValue | None = None, | ||
max_height: DimensionValue | None = None, | ||
position: Position | None = None, | ||
top: DimensionValue | None = None, | ||
bottom: DimensionValue | None = None, | ||
start: DimensionValue | None = None, | ||
end: DimensionValue | None = None, | ||
left: DimensionValue | None = None, | ||
right: DimensionValue | None = None, | ||
z_index: int | None = None, | ||
is_hidden: bool | None = None, | ||
id: str | None = None, | ||
UNSAFE_class_name: str | None = None, | ||
UNSAFE_style: CSSProperties | None = None, | ||
key: str | None = None, | ||
) -> Element: | ||
""" | ||
A footer for a document or section. | ||
|
||
Args: | ||
*children: The items to render within the footer. | ||
flex: When used in a flex layout, specifies how the element will grow or shrink to fit the space available. | ||
flex_grow: When used in a flex layout, specifies how much the element will grow to fit the space available. | ||
flex_shrink: When used in a flex layout, specifies how much the element will shrink to fit the space available. | ||
flex_basis: When used in a flex layout, specifies the initial size of the element. | ||
align_self: Overrides the align_items property of a flex or grid container. | ||
justify_self: Specifies how the element is justified inside a flex or grid container. | ||
order: The layout order for the element within a flex or grid container. | ||
grid_area: The name of the grid area to place the element in. | ||
grid_row: The name of the grid row to place the element in. | ||
grid_row_start: The name of the grid row to start the element in. | ||
grid_row_end: The name of the grid row to end the element in. | ||
grid_column: The name of the grid column to place the element in. | ||
grid_column_start: The name of the grid column to start the element in. | ||
grid_column_end: The name of the grid column to end the element in. | ||
margin: The margin to apply around the element. | ||
margin_top: The margin to apply above the element. | ||
margin_bottom: The margin to apply below the element. | ||
margin_start: The margin to apply before the element. | ||
margin_end: The margin to apply after the element. | ||
margin_x: The margin to apply to the left and right of the element. | ||
margin_y: The margin to apply to the top and bottom of the element. | ||
width: The width of the element. | ||
height: The height of the element. | ||
min_width: The minimum width of the element. | ||
min_height: The minimum height of the element. | ||
max_width: The maximum width of the element. | ||
max_height: The maximum height of the element. | ||
position: Specifies how the element is positioned. | ||
top: The distance from the top of the containing element. | ||
bottom: The distance from the bottom of the containing element. | ||
start: The distance from the start of the containing element. | ||
end: The distance from the end of the containing element. | ||
left: The distance from the left of the containing element. | ||
right: The distance from the right of the containing element. | ||
z_index: The stack order of the element. | ||
is_hidden: Whether the element is hidden. | ||
id: A unique identifier for the element. | ||
UNSAFE_class_name: A CSS class to apply to the element. | ||
UNSAFE_style: A CSS style to apply to the element. | ||
key: A unique identifier used by React to render elements in a list. | ||
|
||
|
||
Returns: | ||
The rendered footer element. | ||
""" | ||
return component_element( | ||
"Footer", | ||
children=children, | ||
flex=flex, | ||
flex_grow=flex_grow, | ||
flex_shrink=flex_shrink, | ||
flex_basis=flex_basis, | ||
align_self=align_self, | ||
justify_self=justify_self, | ||
order=order, | ||
grid_area=grid_area, | ||
grid_column=grid_column, | ||
grid_row=grid_row, | ||
grid_column_start=grid_column_start, | ||
grid_column_end=grid_column_end, | ||
grid_row_start=grid_row_start, | ||
grid_row_end=grid_row_end, | ||
margin=margin, | ||
margin_top=margin_top, | ||
margin_bottom=margin_bottom, | ||
margin_start=margin_start, | ||
margin_end=margin_end, | ||
margin_x=margin_x, | ||
margin_y=margin_y, | ||
width=width, | ||
min_width=min_width, | ||
max_width=max_width, | ||
height=height, | ||
min_height=min_height, | ||
max_height=max_height, | ||
position=position, | ||
top=top, | ||
bottom=bottom, | ||
left=left, | ||
right=right, | ||
start=start, | ||
end=end, | ||
z_index=z_index, | ||
is_hidden=is_hidden, | ||
id=id, | ||
UNSAFE_class_name=UNSAFE_class_name, | ||
UNSAFE_style=UNSAFE_style, | ||
key=key, | ||
) |
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'd group the footer together with the heading/content, rather than having the variant in the middle.