From c684f1c76a2599324c19ca32de10b2f2849fd5e9 Mon Sep 17 00:00:00 2001 From: Vignesh Joglekar Date: Sat, 22 May 2021 04:26:14 -0500 Subject: [PATCH] Various UI Improvements - Makes edit buttons full-length & properly sized - Adds remove filter button in edit menu --- assets/css/app.css | 4 +- assets/js/dashboard/filters.js | 62 ++++++++++++---------- assets/js/dashboard/stats/modals/filter.js | 20 +++++-- assets/tailwind.config.js | 2 +- 4 files changed, 55 insertions(+), 33 deletions(-) diff --git a/assets/css/app.css b/assets/css/app.css index e0d0ad7cd..266f29121 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -311,8 +311,8 @@ iframe[hidden] { @apply cursor-default bg-gray-100 pointer-events-none; } -.filterListText:hover .filterListEdit { - display: block; +.filterListText:hover ~ .filterListEdit { + display: flex; } .filterListText:hover ~ .filterListRemove { diff --git a/assets/js/dashboard/filters.js b/assets/js/dashboard/filters.js index db9190574..5cb54586e 100644 --- a/assets/js/dashboard/filters.js +++ b/assets/js/dashboard/filters.js @@ -174,41 +174,49 @@ class Filters extends React.Component { } renderDropdownFilter(history, [key, value], query) { - return ( -
- {this.filterText(key, value, query)} - - {!['goal', 'props'].includes(key) && - - - } + if (['goal', 'props'].includes(key)) { + return ( +
+ {this.filterText(key, value, query)} this.removeFilter(key, history, query)}>✕ - +
+ ) + } + + return ( +
+ + {this.filterText(key, value, query)} + + + this.removeFilter(key, history, query)}>✕
) } renderListFilter(history, [key, value], query) { - if (!['goal', 'props'].includes(key)) { - return ( - - - {this.filterText(key, value, query)} - - - this.removeFilter(key, history, query)}> - - - - ) - } return ( - - {this.filterText(key, value, query)} - - this.removeFilter(key, history, query)}> - + {['goal', 'props'].includes(key) ? ( + + {this.filterText(key, value, query)} + + ) : ( + <> + + {this.filterText(key, value, query)} + + + + + + )} + this.removeFilter(key, history, query)}> + ) diff --git a/assets/js/dashboard/stats/modals/filter.js b/assets/js/dashboard/stats/modals/filter.js index 91382ac74..84e513e24 100644 --- a/assets/js/dashboard/stats/modals/filter.js +++ b/assets/js/dashboard/stats/modals/filter.js @@ -76,8 +76,8 @@ class FilterModal extends React.Component { name="exclude" onChange={(e) => this.setState({ negated: e.target.checked })} /> - Exclude pages matching this filter - + Exclude pages matching this filter +
} @@ -97,7 +97,21 @@ class FilterModal extends React.Component { className={"button mt-4 w-2/3 mx-auto"} > {query.filters[selectedFilter] ? 'Update' : 'Add'} Filter - + + + {query.filters[selectedFilter] && + + } diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index a56552449..b504ec6fd 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -30,7 +30,7 @@ module.exports = { '9': 9, }, maxWidth: { - '2xs': '16rem', + '2xs': '15rem', '3xs': '12rem', } },