OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add a code example for the collapsibleHeader and do some cleanup
Henriette Darge3eda83fcd7dd
diff --git a/lookbook/docs/components/border-box.md.erb b/lookbook/docs/components/border-box.md.erbindex 4f72d012134..da05770e02e 100644--- a/lookbook/docs/components/border-box.md.erb+++ b/lookbook/docs/components/border-box.md.erb@@ -1,5 +1,6 @@-The Border Box element is used to display structured items in a list, each with a set of actions. It is used for example:+The Border Box element is used to display structured items in a list, each with a set of actions.+<%= embed OpPrimer::BorderBoxComponentPreview, :default %>## Anatomy@@ -12,21 +13,20 @@ If a page uses a Border Box with a header, all sections must use headers.## Header-Note for Parimal:-You can chose between a collapsibleHeader and a free-chosen Header. The collapsible Header consists of Title, counter(optional) and description(optional).--The header can either be static or collapsible.+The header can either be static or collapsible.The collapsibleHeader brings additional functionality:-- an **arrow indicator** next to the title indicates if the section is collapsed or expanded.+- an **arrow indicator** next to the title indicates if the section is collapsed or expanded.- a **header description** (optional) to give additional context to the content of that section. Hidden when collapsed.- a **counter** (optional) displays the number of items that that particular section contains.-+When collapsed, the bottom border is slightly thicker to indicate something is hidden.Both the collapsible header and static heads can accept additional actions. For example, a **more button** can offer additional contextual actions such as edit, delete and move (move up, move to top, move down, move to the end).+<%= embed OpPrimer::BorderBoxComponentPreview, :collapsible %>+## Uses- to display individual meeting agenda items in a meeting@@ -47,8 +47,8 @@ If the content needs to be more structured (with columns and column headers), pl- Don't mix sections with and without headers. If one section has a header, they must all have headers.- Don't make sections collapsible if they do not need to be.-## Technical notes+<%= embed OpPrimer::BorderBoxComponentPreview, :collapsible, panels: %i[source] %>-### Code structure+For detailed examples have a look at the other [border box preview examples](/lookbook/inspect/primer/beta/border_box/playground) or the [collapsible header preview examples](/lookbook/inspect/primer/open_project/border_box/collapsible_header/playground).diff --git a/lookbook/docs/components/border-box-table.md.erb b/lookbook/docs/components/tables/border-box-table.md.erbsimilarity index 96%rename from lookbook/docs/components/border-box-table.md.erbrename to lookbook/docs/components/tables/border-box-table.md.erbindex 349eb098882..52202789d4f 100644--- a/lookbook/docs/components/border-box-table.md.erb+++ b/lookbook/docs/components/tables/border-box-table.md.erb@@ -4,9 +4,9 @@## Anatomy-**Note:** The BorderBoxTable is based on the `Primer::Beta::BorderBox` with a CSS grid applied inside to align the individual rows and make it look like a table. Please note, that it is technically not a table and has therefore none of the benefits a normal HTML table would have (e.g automatic column width adjustments or accessibility short cuts).+**Note:** The BorderBoxTable is based on the `Primer::Beta::BorderBox` with a CSS grid applied inside to align the individual rows and make it look like a table. Please note, that it is technically not a table and has therefore none of the benefits a normal HTML table would have (e.g automatic column width adjustments or accessibility short cuts).-If you want or need that, please use the [TableComponent docs](./tables))+If you want or need that, please use the [TableComponent docs](./tables)## Best practices@@ -27,8 +27,7 @@ If you want or need that, please use the [TableComponent docs](./tables))- to display a list of configured OpenID providers- to display a list of configured SCIM clients-If the content does not need a table structure with column headers and grids, please use the simpler [Border Box](border-box-table) component instead.-+If the content does not need a table structure with column headers and grids, please use the simpler [Border Box](../border_box) component instead.## Technical notesdiff --git a/lookbook/docs/components/tables.md.erb b/lookbook/docs/components/tables/tables.md.erbsimilarity index 100%rename from lookbook/docs/components/tables.md.erbrename to lookbook/docs/components/tables/tables.md.erbdiff --git a/lookbook/previews/op_primer/border_box_component_preview.rb b/lookbook/previews/op_primer/border_box_component_preview.rbnew file mode 100644index 00000000000..0e5e5c55e90--- /dev/null+++ b/lookbook/previews/op_primer/border_box_component_preview.rb@@ -0,0 +1,22 @@+# frozen_string_literal: true++module OpPrimer+ # @hidden+ # @display min_height 400px+ class BorderBoxComponentPreview < Lookbook::Preview+ def default+ render(Primer::Beta::BorderBox.new) do |component|+ component.with_header { "Header" }+ component.with_body { "Body" }+ component.with_row { "Row one" }+ component.with_row { "Row two" }+ component.with_row { "Row three" }+ component.with_footer { "Footer" }+ end+ end++ def collapsible+ render_with_template+ end+ end+enddiff --git a/lookbook/previews/op_primer/border_box_component_preview/collapsible.html.erb b/lookbook/previews/op_primer/border_box_component_preview/collapsible.html.erbnew file mode 100644index 00000000000..f9e33ee6d13--- /dev/null+++ b/lookbook/previews/op_primer/border_box_component_preview/collapsible.html.erb@@ -0,0 +1,49 @@+<%= render(Primer::Beta::BorderBox.new) do |component| %>+ <% component.with_header do %>+ <%= render(+ Primer::OpenProject::BorderBox::CollapsibleHeader.new(+ box: component,+ title: "Collapsible header",+ count: 3+ )+ ) %>+ <% end %>+ <% component.with_body { "Body" } %>+ <% component.with_row do %>+ <%= render(Primer::OpenProject::FlexLayout.new(justify_content: :space_between, align_items: :center)) do |flex| %>+ <%= flex.with_column { "Row 1" } %>+ <%= flex.with_column do %>+ <%= render(Primer::Alpha::ActionMenu.new) do |menu|+ menu.with_show_button(icon: "kebab-horizontal", "aria-label": "More", scheme: :invisible)+ menu.with_item(+ tag: :a,+ label: "Edit",+ href: "#"+ ) do |item|+ item.with_leading_visual_icon(icon: :pencil)+ "foo"+ end+ end %>+ <% end %>+ <% end %>+ <% end %>+ <% component.with_row do %>+ <%= render(Primer::OpenProject::FlexLayout.new(justify_content: :space_between, align_items: :center)) do |flex| %>+ <%= flex.with_column { "Row 2" } %>+ <%= flex.with_column do %>+ <%= render(Primer::Alpha::ActionMenu.new) do |menu|+ menu.with_show_button(icon: "kebab-horizontal", "aria-label": "More", scheme: :invisible)+ menu.with_item(+ tag: :a,+ label: "Edit",+ href: "#"+ ) do |item|+ item.with_leading_visual_icon(icon: :pencil)+ "foo"+ end+ end %>+ <% end %>+ <% end %>+ <% end %>+ <% component.with_footer { "Footer" } %>+<% end %>