Skip to content

Commit

Permalink
add boolean for line clamp more button
Browse files Browse the repository at this point in the history
  • Loading branch information
anish-work committed Jul 15, 2024
1 parent eb6d1c3 commit 1aea3ad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
14 changes: 12 additions & 2 deletions daras_ai_v2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,8 +986,18 @@ def _render(page_cls: typing.Type[BasePage]):
<div class="w-100 mb-2" style="height:150px; background-image: url({preview_image}); background-size:cover; background-position-x:center; background-position-y:30%; background-repeat:no-repeat;"></div>
"""
)
st.markdown(f"###### {root_run.title or page.title}")
st.caption(root_run.notes or page.preview_description(state))
st.markdown(
f"###### {root_run.title or page.title}",
)
with st.link(
to=page.app_url(), className="text-decoration-none cursor-pointer"
):
st.caption(
root_run.notes or page.preview_description(state),
className="text-decoration-none",
line_clamp=7,
line_clamp_expand=False,
)

grid_layout(4, page_clses, _render)

Expand Down
15 changes: 13 additions & 2 deletions gooey_ui/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ def newline():


def markdown(
body: str | None, *, line_clamp: int = None, unsafe_allow_html=False, **props
body: str | None,
*,
line_clamp: int = None,
line_clamp_expand: bool = True,
unsafe_allow_html=False,
**props,
):
if body is None:
return _node("markdown", body="", **props)
Expand All @@ -105,7 +110,13 @@ def markdown(
props["className"] = (
props.get("className", "") + " gui-html-container gui-md-container"
)
return _node("markdown", body=dedent(body).strip(), lineClamp=line_clamp, **props)
return _node(
"markdown",
body=dedent(body).strip(),
lineClamp=line_clamp,
lineClampExpand=line_clamp_expand,
**props,
)


def _node(name: str, **props):
Expand Down

0 comments on commit 1aea3ad

Please sign in to comment.