1+ <% content_for :title, 'Learning Materials' %>
2+ <% content_for(:description, "A list of ruby and ruby on rails learning resources compiled by the ARC community") %>
3+
4+ <div class ="grid pt-20 px-4 md:px-10 lg:px-32 mx-auto place-content-center ">
5+
6+ < h1 class ="text-4xl pt-6 pb-6 font-bold "> Learning Materials</ h1 >
7+
8+ < div class ="mb-6 ">
9+ <%= form_with url : learning_materials_path , method : :get , local : true , class : 'grid grid-cols-1 md:grid-cols-6 gap-4' do %>
10+ < div class ="md:col-span-4 ">
11+ <%= text_field_tag :q , @q , placeholder : 'Search materials (e.g., Rails, Ruby, Active Record, Hotwire)' , class : 'input input-bordered w-full' , id : 'q' %>
12+ </ div >
13+ < div >
14+ <%= select_tag :level , options_for_select ( [ [ 'All Levels' , '' ] , [ 'Beginner' , 'beginner' ] , [ 'Intermediate' , 'intermediate' ] , [ 'Expert' , 'expert' ] ] , @level ) , class : 'select select-bordered w-full' , id : 'level' %>
15+ </ div >
16+ < div >
17+ <%= submit_tag 'Search' , class : 'btn btn-primary w-full' %>
18+ </ div >
19+ <% end %>
20+ </ div >
21+
22+ < hr >
23+
24+ <% if @featured_materials . any? %>
25+ < section class ="mt-10 mb-10 pb-10 border-b border-gray-300 ">
26+ < h2 class ="text-3xl font-bold text-red-600 mb-6 "> Featured</ h2 >
27+ < div class ="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 gap-4 ">
28+ <% @featured_materials . each do |m | %>
29+ < div class ="card bg-base-100 shadow-md overflow-hidden w-full transition-transform duration-300 hover:-translate-y-1 hover:shadow-xl ">
30+ <% if m . thumbnail_url . present? %>
31+ < figure class ="w-full aspect-[4/3] max-h-40 overflow-hidden ">
32+ < img src ="<%= m . thumbnail_url %> " alt ="<%= m . title %> thumbnail " class ="w-full h-full object-cover transition-transform duration-300 ease-out hover:scale-105 ">
33+ </ figure >
34+ <% end %>
35+ < div class ="card-body p-2 ">
36+ < span class ="badge badge-secondary capitalize w-fit text-[10px] "> <%= m . level %> </ span >
37+ < h3 class ="card-title text-lg text-black mt-1 "> <%= m . title %> </ h3 >
38+ < div class ="card-actions justify-start mt-2 ">
39+ <%= link_to 'Open resource' , m . link_url , class : 'link link-primary text-sm transition-colors duration-200 hover:underline' , target : '_blank' , rel : 'noopener' %>
40+ </ div >
41+ </ div >
42+ </ div >
43+ <% end %>
44+ </ div >
45+ </ section >
46+ <% end %>
47+
48+ < section class ="mb-6 ">
49+ < div class ="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 "> <!-- slightly bigger gap -->
50+ <% @materials . each_with_index do |m , i | %>
51+ < div class ="pb-6 border-b border-dotted border-gray-300 w-full max-w-md "> <!-- from sm → md -->
52+ < div class ="card bg-base-100 shadow-md overflow-hidden w-full max-w-md transition-transform duration-300 hover:-translate-y-1 hover:shadow-xl "> <!-- slightly larger card -->
53+ <% if m . thumbnail_url . present? %>
54+ < figure class ="w-full aspect-video max-h-48 overflow-hidden "> <!-- a little taller thumbnail -->
55+ < img src ="<%= m . thumbnail_url %> " alt ="<%= m . title %> thumbnail " class ="w-full h-full object-cover transition-transform duration-300 ease-out hover:scale-105 ">
56+ </ figure >
57+ <% end %>
58+ < div class ="card-body p-3 md:p-4 "> <!-- slightly more breathing room -->
59+ < span class ="badge badge-ghost capitalize w-fit text-xs md:text-sm "> <%= m . level %> </ span >
60+ < h3 class ="card-title text-base mt-1 "> <%= m . title %> </ h3 >
61+ < div class ="card-actions justify-start mt-2 ">
62+ <%= link_to 'Open resource' , m . link_url , class : 'link link-primary text-sm transition-colors duration-200 hover:underline' , target : '_blank' , rel : 'noopener' %>
63+ </ div >
64+ </ div >
65+ </ div >
66+ </ div >
67+ <% end %>
68+ </ div >
69+
70+ </ section >
71+
72+ </ div >
0 commit comments