-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
41 additions
and
19 deletions.
There are no files selected for viewing
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,2 +1,32 @@ | ||
module ApplicationHelper | ||
def icon(name, opts = {}) | ||
opts = opts.symbolize_keys | ||
|
||
variant = opts[:variant]&.to_sym || :solid | ||
default_size = case variant | ||
when :outline, :solid | ||
24 | ||
when :mini | ||
20 | ||
when :micro | ||
16 | ||
end | ||
|
||
size = opts[:size] || default_size | ||
classes = opts[:class] || "" | ||
raise "Do not include w-# or h-# in the class, use :size instead" if classes.match?(/(\bw-|\bh-)/) | ||
classes += " w-[#{size}px] h-[#{size}px]" | ||
|
||
if opts[:title] | ||
direction = opts[:tooltip] || 'top' | ||
|
||
content_tag(:div, class: classes + " tooltip tooltip-#{direction} hover:tooltip-open", data: { tip: opts[:title].to_s }) do | ||
heroicon name, **opts | ||
end | ||
else | ||
content_tag(:div, class: classes) do | ||
heroicon name, **opts | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
|
||
<div class="h-9 flex pr-2 rounded-lg hover:bg-zinc-400 hover:bg-opacity-25 <%= defined?(selected) && selected ? 'bg-zinc-400 bg-opacity-25' : '' %> justify-between items-center group cursor-pointer mr-5"> | ||
<div class="flex-1 ml-2 text-white truncate text-sm text-opacity-80"> | ||
<div class="flex-1 ml-2 text-white truncate text-sm text-opacity-80 w-5"> | ||
Some long text that might be too long and needs to be truncated | ||
</div> | ||
<div class="<%= defined?(selected) && selected ? 'flex' : 'hidden' %> group-hover:flex gap-2 pl-2"> | ||
<% if !defined?(settings) || settings %> | ||
<div class="inline tooltip tooltip-top hover:tooltip-open" data-tip="More"> | ||
<%= heroicon("dots-horizontal", variant: :solid, options: { class: 'ml-1 h-4 w-4 text-gray-400 invisible group-hover:visible hover:text-white cursor-pointer' }) %> | ||
</div> | ||
<%= icon "ellipsis-horizontal", variant: :micro, size: 18, class: "inline ml-1 text-gray-400 invisible group-hover:visible hover:text-white cursor-pointer", title: "More" %> | ||
<% end %> | ||
|
||
<div class="inline tooltip tooltip-top hover:tooltip-open" data-tip="Archive"> | ||
<%= heroicon("archive", variant: :solid, options: { class: "ml-1 h-4 w-4 text-gray-400 cursor-pointer #{defined?(selected) && selected ? 'text-white' : 'invisible group-hover:visible hover:text-white'}" }) %> | ||
</div> | ||
<%= icon "archive-box", variant: :outline, size: 16, class: "inline ml-1 text-gray-400 cursor-pointer #{defined?(selected) && selected ? 'text-white' : 'invisible group-hover:visible hover:text-white'}", title: "Archive" %> | ||
</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div class="hover:bg-gray-100 cursor-pointer inline-flex px-3 py-2 rounded-xl items-center text-bold"> | ||
<%= conversation.assistant.name %> | ||
<%= heroicon("chevron-down", variant: :solid, options: { class: 'ml-1 h-4 w-4 inline text-gray-500' }) %> | ||
<%= icon "chevron-down", variant: :mini, class: 'text-gray-500 ml-[2px]' %> | ||
</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