1+ <%
2+ title "Financial FAQs"
3+ description "Get answers to frequently asked questions about personal finance, investing, budgeting, and wealth management."
4+ %>
5+
6+ <div class ="max-w-6xl mx-auto ">
7+ < div class ="w-full mx-auto max-w-[450px] mb-10 ">
8+ < div class ="gap-x-2 mb-6 text-center ">
9+ <%= image_tag ( "maybe-logo-glow-4x.png" , alt : "Maybe Logo" , style :"width: 115px; margin-left: -22px;" , class : "mb-2 inline" ) %>
10+ < h1 class ="text-6xl text-gray-800 leading-[calc(4rem+8px)] font-medium mb-2 tracking-[-0.02em] "> Financial FAQs</ h1 >
11+ < p class ="text-xl leading-[1.4] text-gray-400 "> Get answers to frequently asked questions about personal finance, investing, budgeting, and wealth management.</ p >
12+ </ div >
13+
14+ <%= form_with method : :get , html : { class : "relative mb-4 max-w-[450px] mx-auto" } , data : { controller : "auto-submit-form" , turbo_frame : "faqs_list" } do |f | %>
15+ <%= f . text_field :q , value : @query ,
16+ class : "w-full py-2.5 px-3 pl-10 bg-white border border-gray-300 shadow-xs rounded-xl text-base leading-[1.4]" ,
17+ placeholder : "Search FAQs..." ,
18+ data : { auto_submit_form_target : "auto" } %>
19+ <%= lucide_icon "search" , class : "absolute top-3 left-3 w-5 h-5 text-gray-500 pointer-events-none" %>
20+ <% end %>
21+
22+ <!-- Category Filter -->
23+ <% if @categories . any? %>
24+ < div class ="mb-8 ">
25+ < div class ="flex flex-wrap gap-2 justify-center ">
26+ <%= link_to "All" , faqs_path ,
27+ class : "px-4 py-2 rounded-full text-sm font-medium transition-colors #{ @selected_category . blank? ? 'bg-gray-900 text-white' : 'bg-gray-200 text-gray-700 hover:bg-gray-300' } " %>
28+ <% @categories . each do |category | %>
29+ <%= link_to category , faqs_path ( category : category ) ,
30+ class : "px-4 py-2 rounded-full text-sm font-medium transition-colors #{ @selected_category == category ? 'bg-gray-900 text-white' : 'bg-gray-200 text-gray-700 hover:bg-gray-300' } " %>
31+ <% end %>
32+ </ div >
33+ </ div >
34+ <% end %>
35+ </ div >
36+
37+ < turbo-frame id ="faqs_list " target ="_top ">
38+ <% if @faqs . any? %>
39+ < div class ="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8 ">
40+ <% @faqs . each do |faq | %>
41+ <%= link_to faq_path ( faq ) , class : "block bg-white p-6 rounded-lg border shadow-xs hover:shadow-sm transition-shadow duration-200" do %>
42+ < h3 class ="text-lg font-semibold mb-3 text-gray-900 leading-tight ">
43+ <%= faq . question %>
44+ </ h3 >
45+ <% if faq . category . present? %>
46+ < div class ="mb-3 ">
47+ < span class ="inline-block px-3 py-1 text-xs font-medium bg-gray-100 text-gray-600 rounded-full ">
48+ <%= faq . category %>
49+ </ span >
50+ </ div >
51+ <% end %>
52+ < p class ="text-sm text-gray-600 leading-relaxed ">
53+ <%= truncate ( strip_tags ( faq . answer ) , length : 120 , separator : ' ' ) %>
54+ </ p >
55+ < div class ="mt-4 flex items-center text-sm font-medium text-gray-900 ">
56+ Read answer
57+ <%= lucide_icon "chevron-right" , class : "ml-1 w-4 h-4" %>
58+ </ div >
59+ <% end %>
60+ <% end %>
61+ </ div >
62+
63+ <!-- Pagination -->
64+ <% if @pagy . pages > 1 %>
65+ < div class ="flex justify-center mt-12 ">
66+ <%== pagy_nav ( @pagy ) %>
67+ </ div >
68+ <% end %>
69+ <% else %>
70+ < div class ="py-56 mx-auto text-center max-w-96 ">
71+ <%= lucide_icon "search-x" , class : "w-6 h-6 mx-auto text-gray-500" %>
72+ < p class ="mt-4 text-sm font-medium "> No FAQs found</ p >
73+ <% if @query . present? %>
74+ < p class ="mt-2 text-sm text-gray-500 "> We didn't find any FAQs matching "<%= @query %> ".</ p >
75+ <% elsif @selected_category . present? %>
76+ < p class ="mt-2 text-sm text-gray-500 "> No FAQs found in the "<%= @selected_category %> " category.</ p >
77+ <% else %>
78+ < p class ="mt-2 text-sm text-gray-500 "> No FAQs available yet.</ p >
79+ <% end %>
80+ </ div >
81+ <% end %>
82+ </ turbo-frame >
83+ </ div >
0 commit comments