Skip to content

Commit

Permalink
Display badge for undocumented components on sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalejandroaguilar committed Oct 9, 2024
1 parent 71811a1 commit 547cf06
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def documented?
@documented
end

def implemented?
"PhlexyUI::#{name}".safe_constantize.present?
end

private

def file_exists?
Expand Down
16 changes: 16 additions & 0 deletions app/views/components/sidebar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ def view_template
examples_path(component),
data: {turbo_frame: :content, turbo_action: :advance}
)
elsif component.implemented?
link_to(
"#",
class: "!cursor-default",
data: {turbo_frame: :content}
) do
span class: "opacity-50" do
component.name
end

Tooltip tip: "Implemented, not documented" do
Badge :outline, :info, class: "opacity-50" do
"Undocumented"
end
end
end
else
link_to(
component.name,
Expand Down

0 comments on commit 547cf06

Please sign in to comment.