|
1 | | -<div class="format max-w-full dark:format-invert"> |
2 | | -<h1><%= @code_object.name %></h1> |
3 | | - |
4 | | -<%= simple_format(@code_object.docstring) %> |
5 | | - |
6 | | -<% if @code_object.tags(:viewcomponent_slot).any? %> |
7 | | - <div class="tags"> |
8 | | - <p class="tag_title">Slots:</p> |
9 | | - <ul class="viewcomponent_slot"> |
10 | | - <% @code_object.tags(:viewcomponent_slot).each do |slot_tag| %> |
11 | | - <li> |
12 | | - <span class="name"><%= slot_tag.name %></span> |
13 | | - <% if slot_tag.types&.any? %> |
14 | | - <span class="type">(<%= slot_tag.types.map { |t| link_to(t, "#") }.join(", ").html_safe %>)</span> |
| 1 | +<article |
| 2 | + class=" |
| 3 | + flex flex-wrap md:flex-nowrap gap-8 w-full items-center |
| 4 | + justify-between mx-auto |
| 5 | + " |
| 6 | +> |
| 7 | + <nav |
| 8 | + id="default-sidebar" |
| 9 | + class="flex-none h-full transition-transform -translate-x-full sm:translate-x-0" |
| 10 | + aria-label="Sidebar" |
| 11 | + > |
| 12 | + <div |
| 13 | + class=" |
| 14 | + h-full -ml-2 pr-6 py-4 overflow-y-auto border-e |
| 15 | + border-default |
| 16 | + " |
| 17 | + > |
| 18 | + <ul class="space-y-2 font-medium"> |
| 19 | + <% all_components.each do |component| %> |
| 20 | + <li> |
| 21 | + <%= link_to component.name, docs_component_path(:id => component.path), class: "flex items-center px-2 py-1.5 text-body rounded-base hover:bg-neutral-tertiary hover:text-fg-brand group" %> |
| 22 | + </li> |
| 23 | + <% end %> |
| 24 | + </ul> |
| 25 | + </div> |
| 26 | + </nav> |
| 27 | + |
| 28 | + <main class="py-4 flex-1 space-y-8"> |
| 29 | + <h1 class="mb-4 text-4xl tracking-tight font-bold text-gray-900 dark:text-white"><%= @code_object.path %></h1> |
| 30 | + |
| 31 | + <% if @code_object.type == :class && @code_object.parent && !@code_object.parent.root? %> |
| 32 | + <section> |
| 33 | + Inherits from |
| 34 | + <%= render(Flowbite::Link.new(href: docs_component_path(@code_object.parent))) do %> |
| 35 | + <code><%= @code_object.parent %></code> |
| 36 | + <% end %> |
| 37 | + </section> |
| 38 | + <% end %> |
| 39 | + |
| 40 | + <% if @child_classes.any? %> |
| 41 | + <section> |
| 42 | + <h2 class="mb-4 mt-8 text-2xl font-bold">In namespace</h2> |
| 43 | + <ul class="list-disc list-inside space-y-2"> |
| 44 | + <% @child_classes.each do |subclass| %> |
| 45 | + <li> |
| 46 | + <%= link_to subclass.name, docs_component_path(:id => subclass.path), class: "text-blue-600 hover:underline" %> |
| 47 | + </li> |
15 | 48 | <% end %> |
16 | | - <% if slot_tag.text.present? %> |
17 | | - — <%= simple_format(slot_tag.text, {}, wrapper_tag: "span") %> |
| 49 | + </ul> |
| 50 | + </section> |
| 51 | + <% end %> |
| 52 | + |
| 53 | + <section class="format dark:format-invert"> |
| 54 | + <%= simple_format(@code_object.docstring) %> |
| 55 | + </section> |
| 56 | + |
| 57 | + <% if @viewcomponent_slots.any? %> |
| 58 | + <section> |
| 59 | + <h2 class="mt-8 text-2xl font-bold">Slots</h2> |
| 60 | + |
| 61 | + <table> |
| 62 | + <% @viewcomponent_slots.each do |slot_tag| %> |
| 63 | + <tr> |
| 64 | + <th class="pt-4 text-left align-top" scope="col"><strong><code><%= slot_tag.name %></code></strong></th> |
| 65 | + <td class="pt-4 align-top ps-4"><%= (slot_tag.types || []).join(", ") %></td> |
| 66 | + <td class="pt-4 align-top ps-4"><%= slot_tag.text %></td> |
| 67 | + </tr> |
18 | 68 | <% end %> |
19 | | - </li> |
| 69 | + </table> |
| 70 | + </section> |
| 71 | + <% end %> |
| 72 | + |
| 73 | + <% if @examples.any? %> |
| 74 | + <section> |
| 75 | + <%- @examples.each do |example| %> |
| 76 | + <h2 class="mt-8 text-2xl font-bold"><%= example.name %></h2> |
| 77 | + <pre><code><%= example.text %></code></pre> |
| 78 | + <% end %> |
| 79 | + </section> |
| 80 | + <% end %> |
| 81 | + |
| 82 | + <% if @lookbook_embeds.any? %> |
| 83 | + <section> |
| 84 | + <h2 class="mt-8 text-2xl font-bold">Examples</h2> |
| 85 | + |
| 86 | + <% @lookbook_embeds.each do |lookbook_tag| %> |
| 87 | + <lookbook-embed panels="source" preview="<%= lookbook_tag.text.strip %>" scenario="*"></lookbook-embed> |
| 88 | + <% end %> |
| 89 | + </section> |
| 90 | + <% end %> |
| 91 | + |
| 92 | + <% if @constructor %> |
| 93 | + <section> |
| 94 | + <h2 class="mt-8 text-2xl font-bold">Constructor</h2> |
| 95 | + |
| 96 | + <code><%= @constructor.signature %></code> |
| 97 | + |
| 98 | + <% if @constructor_arguments.any? %> |
| 99 | + <h3 class="mt-4 text-xl font-bold">Parameters</h3> |
| 100 | + <table> |
| 101 | + <% @constructor_arguments.each do |param| %> |
| 102 | + <tr> |
| 103 | + <th class="pt-4 text-left align-top" scope="col"><strong><code><%= param.name %></code></strong></th> |
| 104 | + <td class="pt-4 align-top ps-4"><%= (param.types || []).join(", ") %></td> |
| 105 | + <td class="pt-4 align-top ps-4"><%= param.text %></td> |
| 106 | + </tr> |
| 107 | + <% end %> |
| 108 | + </table> |
| 109 | + <% end %> |
| 110 | + </section> |
| 111 | + <% end %> |
| 112 | + |
| 113 | + <section> |
| 114 | + <h2 class="mt-8 text-2xl font-bold">See also</h2> |
| 115 | + <%= render(Flowbite::Link.new(href: rubydoc_url(@code_object), data: {turbo: false})) do %> |
| 116 | + Ruby API documentation for |
| 117 | + <code><%= @code_object.type %> <%= @code_object.path %></code> |
20 | 118 | <% end %> |
21 | | - </ul> |
22 | | - </div> |
23 | | -<% end %> |
24 | | - |
25 | | -<%- @code_object.tags(:example).each do |example| %> |
26 | | - <h2><%= example.name %></h2> |
27 | | - <pre><code><%= example.text %></code></pre> |
28 | | -<% end %> |
29 | | - |
30 | | -<% if @code_object.tags(:lookbook_embed).any? %> |
31 | | - <h2>Examples</h2> |
32 | | - |
33 | | - <% @code_object.tags(:lookbook_embed).each do |lookbook_tag| %> |
34 | | - <lookbook-embed panels="source" preview="<%= lookbook_tag.text.strip %>" scenario="*"></lookbook-embed> |
35 | | - <% end %> |
36 | | -<% end %> |
| 119 | + </section> |
| 120 | + </main> |
| 121 | +</article> |
0 commit comments