Skip to content

add close button to search box #654

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions widgets/workflow_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from app_users.models import AppUser
from bots.models import PublishedRun, Workflow, WorkflowAccessLevel
from daras_ai_v2 import icons
from daras_ai_v2.grid_layout_widget import grid_layout
from widgets.saved_workflow import render_saved_workflow_preview
from workspaces.models import WorkspaceRole
Expand All @@ -22,14 +23,25 @@ def render_search_bar(key: str = "search_query", value: str = "") -> str:
r"""
& {
position: relative;
max-width: 500px;
}
& .gui-input {
margin: 0;
width: 100%;
}
& .clear_button {
position: absolute;
top: 17px;
right: 18px;
font-size: 0.9em;
margin: 0 !important;
}
&::before {
content: "\f002"; /* FontAwesome glyph */
font-family: "Font Awesome 6 Pro";
font-family: "Font Awesome 6 Pro";
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
top: 16px;
left: 18px;
pointer-events: none; /* let clicks go through to the input */
color: #888;
font-size: 0.9em;
Expand All @@ -42,10 +54,15 @@ def render_search_bar(key: str = "search_query", value: str = "") -> str:
"",
placeholder="Search Workflows",
className="bg-light border-0 rounded-pill",
style=dict(maxWidth="500px", marginLeft="-0.3rem", paddingLeft="2.7rem"),
style=dict(resize="none", paddingLeft="2.7rem", paddingRight="2.7rem"),
key=key,
value=value,
)
if search_query and gui.button(
icons.cancel, type="link", className="clear_button"
):
gui.session_state[key] = ""
search_query = ""

return search_query

Expand Down