diff --git a/src/app/(pages)/analyst-reports/page.jsx b/src/app/(pages)/analyst-reports/page.jsx index cdd8480..f190c40 100644 --- a/src/app/(pages)/analyst-reports/page.jsx +++ b/src/app/(pages)/analyst-reports/page.jsx @@ -4,6 +4,9 @@ import React, { useState, useEffect } from 'react'; const AnalystReportsPage = () => { const [reports, setReports] = useState([]); const [loading, setLoading] = useState(true); + const [searchQuery, setSearchQuery] = useState(''); + const [momentumFilter, setMomentumFilter] = useState(false); + useEffect(() => { const fetchReports = async () => { try { @@ -19,6 +22,24 @@ const AnalystReportsPage = () => { fetchReports(); }, []); + + const handleSearchChange = (e) => { + setSearchQuery(e.target.value); + }; + + const handleFilterChange = () => { + setMomentumFilter(!momentumFilter); + }; + + const filteredReports = reports.filter((report) => { + const matchesSearch = report.title.toLowerCase().includes(searchQuery.toLowerCase()) || + report.description.toLowerCase().includes(searchQuery.toLowerCase()); + + const matchesFilter = momentumFilter ? report.description.toLowerCase().includes('momentum') : true; + + return matchesSearch && matchesFilter; + }); + return (
{/* Header Section */} @@ -42,7 +63,13 @@ const AnalystReportsPage = () => {

Filter by

- +
@@ -50,7 +77,13 @@ const AnalystReportsPage = () => { {/* Main Content */}
- +
@@ -58,18 +91,19 @@ const AnalystReportsPage = () => {

Read what industry analysts are saying about Google Cloud. The reports listed here are written by third-party industry analysts that cover Google Cloud’s strategy, product portfolio, and differentiation. You can also learn more by reading whitepapers written by Google and the Google community.

+ {loading ? (
Loading reports...
) : ( -
- {reports.map((report, index) => ( -
-

{report.title}

-

{report.description}

- -
- ))} -
+
+ {filteredReports.map((report, index) => ( +
+

{report.title}

+

{report.description}

+ +
+ ))} +
)}