From a8c33f29de766c5b2988a58bc7d4f99d4753f205 Mon Sep 17 00:00:00 2001 From: Adrian Marin Date: Sun, 29 Sep 2024 12:05:41 +0100 Subject: [PATCH 1/2] refactor: floating resource controls in row --- app/components/avo/index/table_row_component.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/components/avo/index/table_row_component.html.erb b/app/components/avo/index/table_row_component.html.erb index 48b77e14e7..c4ff694d78 100644 --- a/app/components/avo/index/table_row_component.html.erb +++ b/app/components/avo/index/table_row_component.html.erb @@ -1,6 +1,6 @@ <%# hover:z-[21] removed from tr class to solve flickering actions component on row controls and z-20 changed to z-21%> <%= content_tag :tr, - class: class_names("bg-white hover:bg-gray-50 hover:shadow-row z-21 border-b", {"cursor-pointer": click_row_to_view_record}), + class: class_names("group bg-white hover:bg-gray-50 z-21 border-b", {"cursor-pointer": click_row_to_view_record}), data: { component_name: self.class.to_s.underscore, resource_name: @resource.class.to_s, @@ -42,7 +42,7 @@ <% end %> <% end %> <% if Avo.configuration.resource_controls_on_the_right? %> - +
<%= render resource_controls_component %>
From 19ddf6d313ccb44965e70427460119ed5204a117 Mon Sep 17 00:00:00 2001 From: Adrian Marin Date: Mon, 30 Sep 2024 22:37:57 +0300 Subject: [PATCH 2/2] wip --- app/assets/stylesheets/avo.base.css | 8 ++++++++ app/components/avo/index/table_row_component.html.erb | 4 ++-- app/views/layouts/avo/application.html.erb | 2 +- lib/avo/configuration.rb | 2 ++ tailwind.preset.js | 1 + 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/avo.base.css b/app/assets/stylesheets/avo.base.css index 67fa61f8d3..5e852c75c5 100644 --- a/app/assets/stylesheets/avo.base.css +++ b/app/assets/stylesheets/avo.base.css @@ -92,3 +92,11 @@ trix-editor { dialog#turbo-confirm { @apply bg-transparent; } + +/* TODO: make content like tailwindcss */ +.floating-row-controls { + &:before { + content: ""; + @apply absolute z-10 inset-auto left-0 top-0 mt-0 -translate-x-full w-3 h-full bg-gradient-to-l from-white to-transparent group-hover:from-gray-50; + } +} diff --git a/app/components/avo/index/table_row_component.html.erb b/app/components/avo/index/table_row_component.html.erb index c4ff694d78..f21daabba4 100644 --- a/app/components/avo/index/table_row_component.html.erb +++ b/app/components/avo/index/table_row_component.html.erb @@ -42,8 +42,8 @@ <% end %> <% end %> <% if Avo.configuration.resource_controls_on_the_right? %> - -
+ +
<%= render resource_controls_component %>
diff --git a/app/views/layouts/avo/application.html.erb b/app/views/layouts/avo/application.html.erb index 5bc8a06c95..2376d153a6 100644 --- a/app/views/layouts/avo/application.html.erb +++ b/app/views/layouts/avo/application.html.erb @@ -26,7 +26,7 @@ <%= render partial: "avo/partials/head" %> <%= content_for :head %> - +
<%= render partial: "avo/partials/navbar" %> diff --git a/lib/avo/configuration.rb b/lib/avo/configuration.rb index c578c896c3..8a2e213886 100644 --- a/lib/avo/configuration.rb +++ b/lib/avo/configuration.rb @@ -2,6 +2,8 @@ module Avo class Configuration include ResourceConfiguration + #TODO: add a configuration switch that adds the necesarry classes + attr_writer :app_name attr_writer :branding attr_writer :root_path diff --git a/tailwind.preset.js b/tailwind.preset.js index 217aa275df..e6386b2b7a 100644 --- a/tailwind.preset.js +++ b/tailwind.preset.js @@ -162,6 +162,7 @@ module.exports = { addVariant('index-grid-view', '.index-grid-view & ') addVariant('index-table-view', '.index-table-view & ') addVariant('kanban-dragging', '.kanban-dragging & ') + addVariant('floating-controls', '.floating-controls & ') }), ], }