1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 18:17:03 +00:00

ui: Add search clear button

This commit is contained in:
James Hillyerd
2019-02-24 08:42:33 -08:00
parent fc95f6e57f
commit 71b3de59af
3 changed files with 17 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ import Html.Attributes
( alt ( alt
, class , class
, classList , classList
, disabled
, download , download
, href , href
, id , id
@@ -500,12 +501,18 @@ view model =
[ div [ class ("mailbox " ++ mode) ] [ div [ class ("mailbox " ++ mode) ]
[ aside [ class "message-list-controls" ] [ aside [ class "message-list-controls" ]
[ input [ input
[ type_ "search" [ type_ "text"
, placeholder "search" , placeholder "search"
, Events.onInput OnSearchInput , Events.onInput OnSearchInput
, value model.searchInput , value model.searchInput
] ]
[] []
, button
[ Events.onClick (OnSearchInput "")
, disabled (model.searchInput == "")
, alt "Clear Search"
]
[ i [ class "fas fa-times" ] [] ]
, button , button
[ Events.onClick PurgeMailboxPrompt [ Events.onClick PurgeMailboxPrompt
, alt "Purge Mailbox" , alt "Purge Mailbox"

View File

@@ -19,7 +19,7 @@
} }
.message-list-controls button, .message-list-controls button,
.message-list-controls input[type="search"] { .message-list-controls input {
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: 3px; border-radius: 3px;
} }
@@ -30,7 +30,12 @@
padding: 0 6px; padding: 0 6px;
} }
.message-list-controls input[type="search"] { .message-list-controls button:disabled {
color: var(--disabled-color);
cursor: default;
}
.message-list-controls input {
flex: 1 1 auto; flex: 1 1 auto;
padding: 2px 4px; padding: 2px 4px;
} }

View File

@@ -4,6 +4,7 @@
--bg-color: #fff; --bg-color: #fff;
--primary-color: #333; --primary-color: #333;
--low-color: #666; --low-color: #666;
--disabled-color: #ddd;
--high-color: #337ab7; --high-color: #337ab7;
--border-color: #ddd; --border-color: #ddd;
--placeholder-color: #9f9f9f; --placeholder-color: #9f9f9f;
@@ -53,6 +54,7 @@ body, button, input, table {
button { button {
background: none; background: none;
cursor: pointer;
} }
h1, h2, h3, h4, h5, h6, p { h1, h2, h3, h4, h5, h6, p {