Skip to content

Commit 964a55d

Browse files
committed
Update tailwind scaffold styling
- Add dark mode specific styling - Update flash message styling - Remove rendering flash and notifications in the layout html
1 parent 1aa6a79 commit 964a55d

File tree

9 files changed

+33
-37
lines changed

9 files changed

+33
-37
lines changed

app/views/shared/_flash_notice.html.erb

Lines changed: 0 additions & 12 deletions
This file was deleted.

app/views/shared/_header.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<nav class="flex flex-wrap items-center justify-between px-3 py-3 bg-gray-100 lg:px-10 dark:bg-slate-900">
33
<%= link_to "Rails + Vue", root_path, class: "text-2xl font-bold text-gray-900 dark:text-green-600 dark:hover:text-green-200" %>
44

5-
<%= link_to "Pandas", pandas_path, class: "text-xl font-bold text-purple-600 dark:text-purple-400 hover:text-purple-800 dark:hover:text-purple-200" %>
5+
<%= link_to "Pandas", pandas_path, class: "text-xl font-bold text-purple-600 dark:text-purple-500 dark:text-purple-400 hover:text-purple-200 dark:hover:text-purple-200" %>
66
</nav>
77
</header>

lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
-%>
2525
<%%= form_with(model: <%= model_resource_name %>, class: "contents") do |form| %>
2626
<%% if <%= singular_table_name %>.errors.any? %>
27-
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3">
28-
<h2><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
27+
<div id="error_explanation" class="bg-red-700 px-2 py-4 mt-2 mx-auto font-sans font-medium text-white rounded-lg">
28+
<h2 class="text-lg mb-2"><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
2929

30-
<ul>
30+
<ul class="list-disc list-inside ml-1">
3131
<%% <%= singular_table_name %>.errors.each do |error| %>
3232
<li><%%= error.full_message %></li>
3333
<%% end %>
@@ -44,24 +44,24 @@
4444

4545
<div class="my-5">
4646
<%%= form.label :password_confirmation %>
47-
<%%= form.password_field :password_confirmation, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
47+
<%%= form.password_field :password_confirmation, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full dark:bg-gray-900 dark:border-gray-600" %>
4848
<% elsif attribute.attachments? -%>
4949
<%%= form.label :<%= attribute.column_name %> %>
50-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
50+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full dark:bg-gray-900 dark:border-gray-600" %>
5151
<% else -%>
5252
<%%= form.label :<%= attribute.column_name %> %>
5353
<% if attribute.field_type == :text_area -%>
54-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, rows: 4, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
54+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, rows: 4, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full dark:bg-gray-900 dark:border-gray-600" %>
5555
<% elsif attribute.field_type == :check_box -%>
5656
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block mt-2 h-5 w-5" %>
5757
<% else -%>
58-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %>
58+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full dark:bg-gray-900 dark:border-gray-600" %>
5959
<% end -%>
6060
<% end -%>
6161
</div>
6262

6363
<% end -%>
6464
<div class="inline">
65-
<%%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
65+
<%%= form.submit class: "rounded-lg py-3 px-5 bg-green-600 hover:bg-green-800 dark:hover:bg-green-500 text-white inline-block font-medium" %>
6666
</div>
6767
<%% end %>

lib/generators/tailwindcss/scaffold/templates/edit.html.erb.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2323
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424
-%>
25-
<div class="mx-auto md:w-2/3 w-full">
25+
<div class="w-full">
2626
<h1 class="font-bold text-4xl">Editing <%= human_name.downcase %></h1>
2727

2828
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
2929

30-
<%%= link_to "Show this <%= human_name.downcase %>", @<%= singular_table_name %>, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
31-
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
30+
<%%= link_to "Show this <%= human_name.downcase %>", @<%= singular_table_name %>, class: "text-purple-600 dark:text-purple-500 ml-5 rounded-lg py-3 inline-block font-medium hover:text-purple-800 dark:hover:text-purple-400" %>
31+
<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper %>_path, class: "text-purple-600 dark:text-purple-500 ml-5 rounded-lg py-3 inline-block font-medium hover:text-purple-800 dark:hover:text-purple-400" %>
3232
</div>

lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@
2424
-%>
2525
<div class="w-full">
2626
<%% if notice.present? %>
27-
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%%= notice %></p>
27+
<div class="bg-green-700 rounded-lg mb-4">
28+
<p class="container px-2 py-4 mx-auto font-sans font-medium text-center text-white rounded" id="notice"><%%= notice %></p>
29+
</div>
2830
<%% end %>
2931

3032
<div class="flex justify-between items-center">
3133
<h1 class="font-bold text-4xl"><%= human_name.pluralize %></h1>
32-
<%%= link_to 'New <%= human_name.downcase %>', new_<%= singular_route_name %>_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
34+
<%%= link_to 'New <%= human_name.downcase %>', new_<%= singular_route_name %>_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium hover:bg-blue-800 dark:hover:bg-blue-500" %>
3335
</div>
3436

3537
<div id="<%= plural_table_name %>" class="min-w-full">

lib/generators/tailwindcss/scaffold/templates/new.html.erb.tt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2323
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424
-%>
25-
<div class="mx-auto md:w-2/3 w-full">
25+
<div class="w-full">
2626
<h1 class="font-bold text-4xl">New <%= human_name.downcase %></h1>
2727

2828
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
2929

30-
<%%= link_to 'Back to <%= human_name.pluralize.downcase %>', <%= index_helper %>_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
30+
<%%= link_to 'Back to <%= human_name.pluralize.downcase %>', <%= index_helper %>_path, class: "text-purple-600 dark:text-purple-500 ml-5 rounded-lg py-3 inline-block font-medium hover:text-purple-800 dark:hover:text-purple-400" %>
3131
</div>

lib/generators/tailwindcss/scaffold/templates/partial.html.erb.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<div id="<%%= dom_id <%= singular_name %> %>">
2626
<% attributes.reject(&:password_digest?).each do |attribute| -%>
2727
<p class="my-5">
28-
<strong class="block font-medium mb-1"><%= attribute.human_name %>:</strong>
28+
<strong class="block font-bold mb-1"><%= attribute.human_name %>:</strong>
2929
<% if attribute.attachment? -%>
3030
<%%= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached? %>
3131
<% elsif attribute.attachments? -%>
@@ -39,8 +39,8 @@
3939

4040
<% end -%>
4141
<%% if action_name != "show" %>
42-
<%%= link_to "Show this <%= human_name.downcase %>", <%= singular_name %>, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
43-
<%%= link_to 'Edit this <%= human_name.downcase %>', edit_<%= singular_name %>_path(<%= singular_name %>), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %>
42+
<%%= link_to "Show this <%= human_name.downcase %>", <%= singular_name %>, class: "text-purple-600 dark:text-purple-500 rounded-lg py-3 inline-block font-medium hover:text-purple-800 dark:hover:text-purple-400" %>
43+
<%%= link_to 'Edit this <%= human_name.downcase %>', edit_<%= singular_name %>_path(<%= singular_name %>), class: "text-purple-600 dark:text-purple-500 rounded-lg py-3 ml-5 inline-block font-medium hover:text-purple-800 dark:hover:text-purple-400" %>
4444
<hr class="mt-6">
4545
<%% end %>
4646
</div>

lib/generators/tailwindcss/scaffold/templates/show.html.erb.tt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,20 @@
2222
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2323
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424
-%>
25-
<div class="mx-auto md:w-2/3 w-full flex">
25+
<div class="w-full">
2626
<div class="mx-auto">
2727
<%% if notice.present? %>
28-
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%%= notice %></p>
28+
<div class="bg-green-700 rounded-lg mb-4">
29+
<p class="container px-2 py-4 mx-auto font-sans font-medium text-center text-white" id="notice"><%%= notice %></p>
30+
</div>
2931
<%% end %>
3032

3133
<%%= render @<%= singular_table_name %> %>
3234

33-
<%%= link_to 'Edit this <%= singular_table_name %>', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
35+
<%%= link_to 'Edit this <%= singular_table_name %>', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: "text-purple-600 dark:text-purple-500 mt-2 pr-5 rounded-lg py-3 inline-block font-medium hover:text-purple-800 dark:hover:text-purple-400" %>
3436
<div class="inline-block ml-2">
35-
<%%= button_to 'Destroy this <%= singular_table_name %>', <%= singular_table_name %>_path(@<%= singular_table_name %>), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
37+
<%%= button_to 'Delete this <%= singular_table_name %>', <%= singular_table_name %>_path(@<%= singular_table_name %>), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-red-100 dark:bg-red-900 font-medium cursor-pointer hover:bg-red-200 dark:hover:bg-red-800" %>
3638
</div>
37-
<%%= link_to 'Back to <%= plural_table_name %>', <%= index_helper %>_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
39+
<%%= link_to 'Back to <%= plural_table_name %>', <%= index_helper %>_path, class: "text-purple-600 dark:text-purple-500 ml-2 ml-5 rounded-lg py-3 inline-block font-medium hover:text-purple-800 dark:hover:text-purple-400" %>
3840
</div>
3941
</div>

tailwind.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import type { Config } from "tailwindcss";
22

33
export default {
4-
content: ["./app/views/**/*.html.erb", "./app/frontend/**/*.vue"],
4+
content: [
5+
"./app/views/**/*.html.erb",
6+
"./app/frontend/**/*.vue",
7+
"./lib/**/*.html.erb.tt",
8+
],
59
theme: {
610
fontFamily: {
711
sans: ["Graphik", "sans-serif"],

0 commit comments

Comments
 (0)