Skip to content

Commit

Permalink
Cleanup a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuchal committed Dec 6, 2023
1 parent 7f7fa1c commit 07c3c65
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 39 deletions.
2 changes: 1 addition & 1 deletion app/components/admin/boxes/box_form_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</div>
<div class="flex justify-start items-center self-stretch gap-4 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200">
<div class="flex flex-col justify-start items-start self-stretch flex-grow overflow-hidden gap-2 rounded-md">
<%= form.select :color, Colorized.select_options, {}, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
<%= form.select :color, helpers.color_select_options, {}, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions app/components/admin/boxes/box_form_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Admin::Boxes::BoxFormComponent < ViewComponent::Base
include ColorizedHelper

def initialize(box:, action:)
@box = box
@action = action
Expand Down
4 changes: 2 additions & 2 deletions app/components/admin/tags/tag_form_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
</div>
<div class="flex justify-start items-center self-stretch gap-4 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200">
<div class="flex flex-col justify-start items-start self-stretch flex-grow overflow-hidden gap-2 rounded-md">
<%= form.select :color, Colorized.select_options, {}, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
<%= form.select :color, helpers.color_select_options, {}, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
</div>
</div>
<div class="flex justify-start items-center self-stretch gap-4 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200">
<div class="flex flex-col justify-start items-start self-stretch flex-grow overflow-hidden gap-2 rounded-md">
<%= form.select :icon, Iconized.select_options, {}, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
<%= form.select :icon, helpers.icon_select_options, {}, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions app/components/admin/tags/tag_form_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class Admin::Tags::TagFormComponent < ViewComponent::Base
include ColorizedHelper, IconizedHelper
def initialize(tag:)
@tag = tag
end
Expand Down
4 changes: 0 additions & 4 deletions app/components/common/icon_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,5 @@ def initialize(icon, classes: "")
@svg = ICONS[icon]
@classes = classes
end

def self.select_options
[""] + ICONS.keys
end
end
end
24 changes: 0 additions & 24 deletions app/components/common/tag_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,3 @@ def initialize(tag, classes="", color: nil)
end
end
end

# NOTE: Tailwind processor catches these
# class="bg-slate-50 border-slate-400 text-slate-600 ring-slate-500/10"
# class="bg-gray-50 border-gray-400 text-gray-600 ring-gray-500/10"
# class="bg-zinc-50 border-zinc-400 text-zinc-600 ring-zinc-500/10"
# class="bg-neutral-50 border-neutral-400 text-neutral-600 ring-neutral-500/10"
# class="bg-stone-50 border-stone-400 text-stone-600 ring-stone-500/10"
# class="bg-red-50 border-red-400 text-red-600 ring-red-500/10"
# class="bg-orange-50 border-orange-400 text-orange-600 ring-orange-500/10"
# class="bg-amber-50 border-amber-400 text-amber-600 ring-amber-500/10"
# class="bg-yellow-50 border-yellow-400 text-yellow-600 ring-yellow-500/10"
# class="bg-lime-50 border-lime-400 text-lime-600 ring-lime-500/10"
# class="bg-green-50 border-green-400 text-green-600 ring-green-500/10"
# class="bg-emerald-50 border-emerald-400 text-emerald-600 ring-emerald-500/10"
# class="bg-teal-50 border-teal-400 text-teal-600 ring-teal-500/10"
# class="bg-cyan-50 border-cyan-400 text-cyan-600 ring-cyan-500/10"
# class="bg-sky-50 border-sky-400 text-sky-600 ring-sky-500/10"
# class="bg-blue-50 border-blue-400 text-blue-600 ring-blue-500/10"
# class="bg-indigo-50 border-indigo-400 text-indigo-600 ring-indigo-500/10"
# class="bg-violet-50 border-violet-400 text-violet-600 ring-violet-500/10"
# class="bg-purple-50 border-purple-400 text-purple-600 ring-purple-500/10"
# class="bg-fuchsia-50 border-fuchsia-400 text-fuchsia-600 ring-fuchsia-500/10"
# class="bg-pink-50 border-pink-400 text-pink-600 ring-pink-500/10"
# class="bg-rose-50 border-rose-400 text-rose-600 ring-rose-500/10"
4 changes: 0 additions & 4 deletions app/models/concerns/colorized.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,5 @@ def self.colors
:rose
]
end

def self.select_options
[""] + colors.map { |color| [color, { class: "bg-#{color}-100 text-#{color}-600" }] }
end
end

4 changes: 0 additions & 4 deletions app/models/concerns/iconized.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ def self.icons
Common::IconComponent::ICONS.keys
end

def self.select_options
[""] + icons
end

included do
validates_inclusion_of :icon, in: Iconized.icons, allow_blank: true
end
Expand Down

0 comments on commit 07c3c65

Please sign in to comment.