|
1 | | -<h2> |
2 | | - <%= link_to "Open Source example", |
3 | | - "https://github.com/shakacode/react-webpack-rails-tutorial/" %> of using the <%= link_to "React on Rails gem", "https://github.com/shakacode/react_on_rails" %> |
4 | | - and the <%= link_to "Shakapacker gem", "https://github.com/shakacode/shakapacker" %> |
5 | | -</h2> |
6 | | -<h3>Using <%= link_to "Ruby on Rails", "http://rubyonrails.org/" %> with |
7 | | - <%= link_to "Action Cable", "http://guides.rubyonrails.org/action_cable_overview.html" %> + |
8 | | - <%= link_to "React", "http://facebook.github.io/react/" %> (Server rendering) + |
9 | | - <%= link_to "Redux", "https://github.com/reactjs/redux" %> + |
10 | | - <%= link_to "React Router", "https://github.com/reactjs/react-router" %> |
11 | | -</h3> |
12 | | -<%= render "header" %> |
13 | | - |
14 | | -<!--Note, pre-rendering set in /config/initializers/react_on_rails.rb --> |
15 | | -<%= react_component('RouterApp', id: "RouterApp-react-component-0") %> |
| 1 | +<div class="relative isolate overflow-hidden py-10 sm:py-14"> |
| 2 | + <div class="pointer-events-none absolute inset-x-0 top-0 -z-10 h-[32rem] bg-[radial-gradient(circle_at_top_left,_rgba(14,165,233,0.18),_transparent_42%),radial-gradient(circle_at_80%_20%,_rgba(245,158,11,0.14),_transparent_32%)]"></div> |
| 3 | + |
| 4 | + <section class="mx-auto max-w-6xl"> |
| 5 | + <div class="grid gap-8 lg:grid-cols-[minmax(0,1.2fr)_minmax(320px,0.8fr)] lg:items-start"> |
| 6 | + <div class="space-y-6"> |
| 7 | + <span class="inline-flex items-center rounded-full border border-sky-200 bg-white/80 px-4 py-2 text-xs font-semibold uppercase tracking-[0.28em] text-sky-700 shadow-sm shadow-sky-100 backdrop-blur"> |
| 8 | + React on Rails Tutorial |
| 9 | + </span> |
| 10 | + |
| 11 | + <div class="space-y-4"> |
| 12 | + <h1 class="max-w-4xl text-5xl leading-[1.05] text-slate-900 sm:text-6xl"> |
| 13 | + Server-rendered React, Rails, and real-time updates in one sharper demo. |
| 14 | + </h1> |
| 15 | + <p class="max-w-3xl text-lg leading-8 text-slate-600 sm:text-xl"> |
| 16 | + This open source example shows how the |
| 17 | + <%= link_to "React on Rails gem", "https://github.com/shakacode/react_on_rails" %> |
| 18 | + and |
| 19 | + <%= link_to "Shakapacker gem", "https://github.com/shakacode/shakapacker" %> |
| 20 | + fit into a Rails application without forcing the whole stack into a single-page app mold. |
| 21 | + </p> |
| 22 | + </div> |
| 23 | + |
| 24 | + <div class="flex flex-wrap gap-3"> |
| 25 | + <%= link_to "Browse the Source", |
| 26 | + "https://github.com/shakacode/react-webpack-rails-tutorial/", |
| 27 | + class: "inline-flex items-center rounded-full bg-slate-900 px-5 py-3 text-sm font-semibold text-white shadow-lg shadow-slate-200 transition hover:bg-slate-800" %> |
| 28 | + <%= link_to "Read the README", |
| 29 | + "https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/README.md", |
| 30 | + class: "inline-flex items-center rounded-full border border-slate-300 bg-white/80 px-5 py-3 text-sm font-semibold text-slate-700 shadow-sm shadow-slate-200 transition hover:border-sky-300 hover:text-sky-700" %> |
| 31 | + <%= link_to "See the React-only Route", |
| 32 | + no_router_path, |
| 33 | + class: "inline-flex items-center rounded-full border border-amber-200 bg-amber-50 px-5 py-3 text-sm font-semibold text-amber-900 shadow-sm shadow-amber-100 transition hover:border-amber-300 hover:bg-amber-100" %> |
| 34 | + </div> |
| 35 | + |
| 36 | + <div class="grid gap-4 pt-2 sm:grid-cols-2 xl:grid-cols-4"> |
| 37 | + <div class="rounded-3xl border border-white/80 bg-white/70 p-5 shadow-sm shadow-sky-100 backdrop-blur"> |
| 38 | + <p class="text-xs font-semibold uppercase tracking-[0.24em] text-sky-700">Rendering</p> |
| 39 | + <p class="mt-3 text-lg font-semibold text-slate-900">SSR + Hydration</p> |
| 40 | + <p class="mt-2 text-sm leading-6 text-slate-600">React content renders on the server first, then hydrates cleanly on the client.</p> |
| 41 | + </div> |
| 42 | + <div class="rounded-3xl border border-white/80 bg-white/70 p-5 shadow-sm shadow-sky-100 backdrop-blur"> |
| 43 | + <p class="text-xs font-semibold uppercase tracking-[0.24em] text-sky-700">Real Time</p> |
| 44 | + <p class="mt-3 text-lg font-semibold text-slate-900">Action Cable</p> |
| 45 | + <p class="mt-2 text-sm leading-6 text-slate-600">New comments stream in live, so the sample feels like an app instead of static documentation.</p> |
| 46 | + </div> |
| 47 | + <div class="rounded-3xl border border-white/80 bg-white/70 p-5 shadow-sm shadow-sky-100 backdrop-blur"> |
| 48 | + <p class="text-xs font-semibold uppercase tracking-[0.24em] text-sky-700">Tooling</p> |
| 49 | + <p class="mt-3 text-lg font-semibold text-slate-900">Webpack or Rspack</p> |
| 50 | + <p class="mt-2 text-sm leading-6 text-slate-600">The tutorial shows a modern Shakapacker setup that can switch bundlers without reworking the app.</p> |
| 51 | + </div> |
| 52 | + <div class="rounded-3xl border border-white/80 bg-white/70 p-5 shadow-sm shadow-sky-100 backdrop-blur"> |
| 53 | + <p class="text-xs font-semibold uppercase tracking-[0.24em] text-sky-700">Comparison</p> |
| 54 | + <p class="mt-3 text-lg font-semibold text-slate-900">Multiple UI Paths</p> |
| 55 | + <p class="mt-2 text-sm leading-6 text-slate-600">Compare React Router, plain React, Stimulus, classic Rails, and ReScript in the same project.</p> |
| 56 | + </div> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | + |
| 60 | + <aside class="relative overflow-hidden rounded-[2rem] border border-slate-800/5 bg-slate-900 px-6 py-7 text-slate-100 shadow-2xl shadow-sky-100"> |
| 61 | + <div class="pointer-events-none absolute inset-x-0 top-0 h-36 bg-[radial-gradient(circle_at_top,_rgba(125,211,252,0.35),_transparent_60%)]"></div> |
| 62 | + <div class="relative space-y-6"> |
| 63 | + <div> |
| 64 | + <p class="text-xs font-semibold uppercase tracking-[0.28em] text-sky-300">Stack at a Glance</p> |
| 65 | + <h2 class="mt-3 text-3xl text-white">One codebase, several integration styles.</h2> |
| 66 | + <p class="mt-3 text-sm leading-7 text-slate-300"> |
| 67 | + Use this page as the front door, then jump into the specific route that demonstrates the architecture choice you care about. |
| 68 | + </p> |
| 69 | + </div> |
| 70 | + |
| 71 | + <div class="grid gap-3"> |
| 72 | + <%= link_to simple_path, |
| 73 | + class: "group rounded-2xl border border-white/10 bg-white/5 p-4 transition hover:border-sky-300/40 hover:bg-white/10 hover:no-underline" do %> |
| 74 | + <p class="text-sm font-semibold text-white">Simple React</p> |
| 75 | + <p class="mt-1 text-sm text-slate-300">Minimal client-side React mount with no server-rendered HTML.</p> |
| 76 | + <% end %> |
| 77 | + |
| 78 | + <%= link_to stimulus_path, |
| 79 | + class: "group rounded-2xl border border-white/10 bg-white/5 p-4 transition hover:border-sky-300/40 hover:bg-white/10 hover:no-underline" do %> |
| 80 | + <p class="text-sm font-semibold text-white">Stimulus Demo</p> |
| 81 | + <p class="mt-1 text-sm text-slate-300">See Hotwire-style behavior next to the React examples inside the same Rails app.</p> |
| 82 | + <% end %> |
| 83 | + |
| 84 | + <%= link_to rescript_path, |
| 85 | + class: "group rounded-2xl border border-white/10 bg-white/5 p-4 transition hover:border-sky-300/40 hover:bg-white/10 hover:no-underline" do %> |
| 86 | + <p class="text-sm font-semibold text-white">ReScript Variant</p> |
| 87 | + <p class="mt-1 text-sm text-slate-300">Compare a typed front-end implementation that still runs through the same Rails integration story.</p> |
| 88 | + <% end %> |
| 89 | + </div> |
| 90 | + |
| 91 | + <div class="rounded-2xl border border-white/10 bg-white/5 p-4"> |
| 92 | + <p class="text-xs font-semibold uppercase tracking-[0.24em] text-sky-300">Core Stack</p> |
| 93 | + <ul class="mt-3 space-y-2 text-sm leading-6 text-slate-300"> |
| 94 | + <li>Ruby on Rails for routing, controllers, persistence, and the demo shell.</li> |
| 95 | + <li>React + Redux for the interactive comment workflow.</li> |
| 96 | + <li>React Router for server rendering and route transitions.</li> |
| 97 | + <li>Tailwind CSS for utility-first styling layered on the Rails app.</li> |
| 98 | + </ul> |
| 99 | + </div> |
| 100 | + </div> |
| 101 | + </aside> |
| 102 | + </div> |
| 103 | + </section> |
| 104 | + |
| 105 | + <div class="mx-auto mt-12 max-w-6xl"> |
| 106 | + <%= render "header" %> |
| 107 | + </div> |
| 108 | + |
| 109 | + <section class="mx-auto mt-12 max-w-6xl"> |
| 110 | + <div class="flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between"> |
| 111 | + <div class="max-w-3xl"> |
| 112 | + <p class="text-xs font-semibold uppercase tracking-[0.28em] text-sky-700">Live Playground</p> |
| 113 | + <h2 class="mt-3 text-4xl text-slate-900">Try the server-rendered React Router demo directly on the home page.</h2> |
| 114 | + <p class="mt-3 text-base leading-7 text-slate-600"> |
| 115 | + The block below is the actual interactive sample. It renders on the server, hydrates on the client, and keeps comment updates flowing through Action Cable. |
| 116 | + </p> |
| 117 | + </div> |
| 118 | + |
| 119 | + <div class="flex flex-wrap gap-3"> |
| 120 | + <%= link_to "Classic Rails", |
| 121 | + comments_path, |
| 122 | + class: "inline-flex items-center rounded-full border border-slate-300 bg-white/80 px-4 py-2 text-sm font-semibold text-slate-700 shadow-sm shadow-slate-200 transition hover:border-sky-300 hover:text-sky-700" %> |
| 123 | + <%= link_to "No Router React", |
| 124 | + no_router_path, |
| 125 | + class: "inline-flex items-center rounded-full border border-slate-300 bg-white/80 px-4 py-2 text-sm font-semibold text-slate-700 shadow-sm shadow-slate-200 transition hover:border-sky-300 hover:text-sky-700" %> |
| 126 | + </div> |
| 127 | + </div> |
| 128 | + |
| 129 | + <div class="relative mt-8 overflow-hidden rounded-[2rem] border border-white/80 bg-white/80 p-6 shadow-[0_32px_80px_-48px_rgba(15,23,42,0.5)] backdrop-blur sm:p-8 lg:p-10"> |
| 130 | + <div class="pointer-events-none absolute inset-x-0 top-0 h-32 bg-gradient-to-b from-sky-50 via-white/60 to-transparent"></div> |
| 131 | + <div class="relative"> |
| 132 | + <%= react_component('RouterApp', id: "RouterApp-react-component-0") %> |
| 133 | + </div> |
| 134 | + </div> |
| 135 | + </section> |
| 136 | +</div> |
0 commit comments