feat(ui): redesign landing page search and empty states
- Hide empty state placeholder on initial load - Add prominent hero mode to FilterBar when no search is active - Fix SchoolCard test TypeScript and assertion errors
This commit is contained in:
@@ -29,6 +29,7 @@ export function HomeView({ initialSchools, filters }: HomeViewProps) {
|
||||
|
||||
const hasSearch = searchParams.get('search') || searchParams.get('postcode');
|
||||
const isLocationSearch = !!searchParams.get('postcode');
|
||||
const isSearchActive = !!(hasSearch || searchParams.get('local_authority') || searchParams.get('school_type'));
|
||||
|
||||
// Close bottom sheet if we change views or search
|
||||
useEffect(() => {
|
||||
@@ -45,6 +46,7 @@ export function HomeView({ initialSchools, filters }: HomeViewProps) {
|
||||
|
||||
<FilterBar
|
||||
filters={filters}
|
||||
isHero={!isSearchActive}
|
||||
/>
|
||||
|
||||
{/* Location Info Banner with View Toggle */}
|
||||
@@ -107,26 +109,18 @@ export function HomeView({ initialSchools, filters }: HomeViewProps) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{initialSchools.schools.length === 0 ? (
|
||||
{initialSchools.schools.length === 0 && isSearchActive ? (
|
||||
<EmptyState
|
||||
title={hasSearch ? "No schools found" : "Search for Schools"}
|
||||
message={
|
||||
hasSearch
|
||||
? "Try adjusting your search criteria or filters to find schools."
|
||||
: "Use the search above to find schools by name or search by location to discover schools near a postcode."
|
||||
}
|
||||
action={
|
||||
hasSearch
|
||||
? {
|
||||
label: 'Clear all filters and show featured schools',
|
||||
onClick: () => {
|
||||
window.location.href = '/';
|
||||
},
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
title="No schools found"
|
||||
message="Try adjusting your search criteria or filters to find schools."
|
||||
action={{
|
||||
label: 'Clear all filters',
|
||||
onClick: () => {
|
||||
window.location.href = '/';
|
||||
},
|
||||
}}
|
||||
/>
|
||||
) : resultsView === 'map' && isLocationSearch ? (
|
||||
) : initialSchools.schools.length > 0 && resultsView === 'map' && isLocationSearch ? (
|
||||
/* Map View Layout */
|
||||
<div className={styles.mapViewContainer}>
|
||||
<div className={styles.mapContainer}>
|
||||
|
||||
Reference in New Issue
Block a user