From 3f0309c36a54c0ba38b070a602dd6c074b0aa72c Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 22 Nov 2021 10:05:04 +0530 Subject: [PATCH 1/2] fix: search empty state improvements --- school/public/css/style.css | 25 ++++++++++++++++--- .../search_course/search_course.html | 2 +- .../templates/search_course/search_course.js | 10 ++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/school/public/css/style.css b/school/public/css/style.css index 84094b90..2be40e4f 100644 --- a/school/public/css/style.css +++ b/school/public/css/style.css @@ -1376,7 +1376,7 @@ pre { } .search-course { - background-image: url(/assets/frappe/icons/timeless/search.svg); + background-image: url(/assets/frappe/icons/timeless/search.svg); border: 1px solid #C8CFD5; box-sizing: border-box; border-radius: 6px; @@ -1384,8 +1384,8 @@ pre { padding: 0.625rem 0.75rem; height: 36px; background-repeat: no-repeat; - text-indent: 1.5rem; - background-position: 1rem 0.65rem; + text-indent: 1.5rem; + background-position: 1rem 0.65rem; } .section-heading { @@ -1461,3 +1461,22 @@ pre { top: 4rem; margin-bottom: 5rem; } + +.close-search-empty-state { + position: absolute; + top: 0; + right: 0; + padding: 0.75rem 1.25rem; + float: right; + font-size: 1.5rem; + font-weight: 700; + line-height: 1; + color: #000; + text-shadow: 0 1px 0 #fff; + opacity: .5; +} + +.close-search-empty-state:hover { + text-decoration: none; + color: #000; +} diff --git a/school/templates/search_course/search_course.html b/school/templates/search_course/search_course.html index 73445f1b..96041965 100644 --- a/school/templates/search_course/search_course.html +++ b/school/templates/search_course/search_course.html @@ -1,7 +1,7 @@
- × + ×
{{ _("No results found") }}
{{ _("Try some other keyword or explore our list of courses.") }}
diff --git a/school/templates/search_course/search_course.js b/school/templates/search_course/search_course.js index b74d0d5f..0126f8e9 100644 --- a/school/templates/search_course/search_course.js +++ b/school/templates/search_course/search_course.js @@ -2,6 +2,11 @@ frappe.ready(() => { $(".search-course").keyup((e) => { search_course(e); }); + + $(".close-search-empty-state").click((e) => { + close_search_empty_state(e); + }); + }); const search_course = (e) => { @@ -62,3 +67,8 @@ const fix_heading_styles = () => { $(".course-home-headings").removeClass("hide"); $(".upcoming-courses").addClass("mt-10"); } + +const close_search_empty_state = (e) => { + $(".search-empty-state").addClass("hide"); + $(".search-course").val(""); +} From 6195d72c3cd8bb8202de0cbc91867ebb50e96d16 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 22 Nov 2021 10:08:54 +0530 Subject: [PATCH 2/2] fix: indentation --- school/public/css/style.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/school/public/css/style.css b/school/public/css/style.css index 2be40e4f..adb77517 100644 --- a/school/public/css/style.css +++ b/school/public/css/style.css @@ -1376,7 +1376,7 @@ pre { } .search-course { - background-image: url(/assets/frappe/icons/timeless/search.svg); + background-image: url(/assets/frappe/icons/timeless/search.svg); border: 1px solid #C8CFD5; box-sizing: border-box; border-radius: 6px; @@ -1384,8 +1384,8 @@ pre { padding: 0.625rem 0.75rem; height: 36px; background-repeat: no-repeat; - text-indent: 1.5rem; - background-position: 1rem 0.65rem; + text-indent: 1.5rem; + background-position: 1rem 0.65rem; } .section-heading {