% if @other_applications %>
<%= render "govuk_publishing_components/components/heading", {
text: "Components in the gem",
font_size: "l",
margin_bottom: 6,
} %>
<% end %>
<% if @components.any? %>
<% component_items = [] %>
<% component_files = capture do %>
<%= render partial: "component_contents" %>
<% end %>
<%
component_items << {
heading: {
text: "Component files",
},
summary: {
text: "Lists what files each component has",
},
content: {
html: component_files
},
}
%>
<% components_within_components = capture do %>
<% @components[:components_containing_components].each do |component| %>
<% end %>
<% end %>
<%
component_items << {
heading: {
text: "Components containing other components",
},
summary: {
text: "Shows which components contain other components",
},
content: {
html: components_within_components
},
}
%>
<%= render 'items_in_applications',
heading: 'Components by application',
summary: 'Shows which applications use each component',
content: @components[:components_by_application],
items: component_items
%>
<% helpers_by_component = capture do %>
<% @components[:helper_usage].each do |helper| %>
-
<%= helper[:name] %>
-
Used by <%= helper[:used_by].length %> components
<% helper[:used_by].each do |component| %>
<% github_link = 'https://github.com/alphagov/govuk_publishing_components/tree/main/app/views/govuk_publishing_components/components/' %>
-
<%= component[:name] %>
<% end %>
<% end %>
<% end %>
<%
component_items << {
heading: {
text: "Helpers by component",
},
summary: {
text: "Shows which components use common helpers",
},
content: {
html: helpers_by_component
},
}
%>
<%= render 'items_in_applications',
heading: 'Helpers by application',
summary: 'Shows any applications that use helpers from the components gem',
content: @components[:helpers_used_by_applications],
items: component_items
%>
<%= render "govuk_publishing_components/components/accordion", {
items: component_items
} %>
<% else %>
No components found.
<% end %>