-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update templates and dark mode styles (#8187)
* Update main navigation layout This is a work in progress. * Inline body styles * Update comments admin resource index table This adds some min widths and truncates the comment body. * Update users test data template * Update pagination styles for dark mode We were setting default background color but its not needed since we prefer to take on the inherited background color and just apply an explicit background color on hover. * Delete pagination first/last page partials Since these are not used by the paginator we can safely delete these. Forgot to do so when combining the two original themes we had (active_admin and active_admin_countless) for a simpler, modern pagination layout. * Refactor breadcrumbs with link_to html_options This way we can style the default breadcrumbs from the view with Tailwind classes. If providing custom breadcrumb, since full links are given, caller should provide any classes for styling. This improves colors for light and dark modes. * Update dark mode styles Still some elements to update with better dark mode styles but this gets most of the contents on the page. Updated the main navigation layout and hover/selected states. Updated the data-table and attributes-table styles, not just dark mode but spacing, borders and other styles. Imrpoved the empty-value style for all modes too. * Fix main navigation positioning The content was going off screen due to h-screen usage. This was fine originally since we had the menu always be full screen vertically but we've changed that now so have to adjust the top offset based on breakpoint. * Use add_class for default so Tailwind finds it Otherwise these styles are purged which we don't want. * Update status tag styles Use whitespace nowrap so multi word status tags don't wrap in a table. Use pill shaped badges instead. No need to duplicate styles here since the second selector is just for updating the color based on the data attribute. * Use NPM package for Tailwind plugin This will be required for now with cssbundling-rails. Another option is to copy and paste the plugin.js file to the host app and run it and it will work. That could be an option for tailwindcss-rails users. At the moment there isn't another alternative. I've tried requiring the plugin from the gem path but it doens't seem that Tailwind can find its own modules if required that way. It has to be local. * Consolidate html head partials to one partial Originally, we needed this as we didn't extract other views in the layout to partials. No need for specific partials now since chances are if someone wants to edit this, they will want to edit most of the HTML head anyway so easier to extract a single partial with everything already there as its not that many lines. Since we've improved many of the layout helpers, we'll just inline the title tag now and not sanitize since this is commonly extracted, its much easier now for users to add that in if they want it. We added sanitized due to testing the site title with a link but we've since changed that so the site title really should just be plain text for situations like this. The link was used because often it doubled as the site title in the site header HTML but that is expected to be fully customized and branded now.
- Loading branch information
1 parent
72385cf
commit 54bcf81
Showing
39 changed files
with
126 additions
and
205 deletions.
There are no files selected for viewing
6 changes: 5 additions & 1 deletion
6
...ive_admin/html_head/_javascripts.html.erb → app/views/active_admin/_html_head.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<div id="main-menu" class="fixed top-0 xl:top-16 bottom-0 left-0 z-40 w-72 xl:w-60 p-4 overflow-y-auto transition-transform duration-200 -translate-x-full xl:translate-x-0 bg-white dark:bg-gray-950 xl:border-r xl:border-gray-200 xl:dark:border-white/10" tabindex="-1" aria-labelledby="drawer-navigation-label"> | ||
<ul role="list" class="flex flex-1 flex-col space-y-1.5"> | ||
<% current_menu.items(self).each do |item| %> | ||
<% children = item.items(self).presence %> | ||
<li <%= current_menu_item?(item) && "data-open" %> data-item-id="<%= item.id %>"> | ||
<% if children %> | ||
<button data-menu-button class="text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white flex items-center w-full text-left rounded-md p-2 gap-x-2 text-sm"> | ||
<%= item.label(self) %> | ||
<svg data-menu-icon class="ms-auto h-5 w-5 shrink-0 <%= current_menu_item?(item) && "rotate-90" %>" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||
<path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" /> | ||
</svg> | ||
</button> | ||
<ul data-menu-list role="list" class="mt-1 space-y-1 <%= current_menu_item?(item) ? "" : "hidden" %>"> | ||
<% children.each do |j| %> | ||
<li data-item-id="<%= j.id %>"> | ||
<%= link_to j.label(self), j.url(self), j.html_options.merge(class: "text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white block rounded-md py-1.5 px-2 text-sm #{(current_menu_item?(j) ? "bg-gray-100 dark:bg-white/5 text-gray-900 dark:text-white selected" : "")}") %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
<% elsif url = item.url(self) %> | ||
<%= link_to item.label(self), url, item.html_options.merge(class: "text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white flex items-center w-full text-left rounded-md p-2 gap-x-2 text-sm #{(current_menu_item?(item) ? "bg-gray-100 dark:bg-white/5 text-gray-900 dark:text-white selected" : "")}") %> | ||
<% else %> | ||
<%= item.label(self) %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
en: | ||
views: | ||
pagination: | ||
first: "First" | ||
last: "Last" | ||
previous: "Previous" | ||
next: "Next" | ||
activerecord: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
# frozen_string_literal: true | ||
module ActiveAdmin | ||
class Component < Arbre::Component | ||
def initialize(*) | ||
super | ||
add_class default_class_name | ||
end | ||
|
||
def default_class_name | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.