Skip to content

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

Basic documentation on Layout + SidePanel

Oliver Günther2f97a043f1a5
diff --git a/lookbook/docs/patterns/01-layout.md.erb b/lookbook/docs/patterns/01-layout.md.erb
new file mode 100644
index 00000000000..d173d816f9b
--- /dev/null
+++ b/lookbook/docs/patterns/01-layout.md.erb
@@ -0,0 +1,17 @@
+OpenProject provides several ways to layout your page.
+
+## Layout component
+
+On a primerized page, you may want to use the `Primer::Beta::Layout` component, which will give
+you a layout with a side panel and a main content area, stacking behavior for mobile, and more.
+
+### Component overview
+
+These are the involved primer components:
+
+- `Primer::Beta::Layout` - The main layout component. For more information, see https://primer.style/components/layout/rails/alpha and [the preview for the component](/lookbook/inspect/primer/alpha/layout/playground)
+- `Primer::OpenProject::SidePanel` - Side panel component for one or multiple sections
+
+Here is an example on how this would be used:
+
+<%= embed Patterns::LayoutPreview, :default, panels: %i[source] %>
diff --git a/lookbook/previews/patterns/layout_preview.rb b/lookbook/previews/patterns/layout_preview.rb
new file mode 100644
index 00000000000..151a202aa7c
--- /dev/null
+++ b/lookbook/previews/patterns/layout_preview.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+module Patterns
+ # @hidden
+ class LayoutPreview < ViewComponent::Preview
+ # @display min_height 500px
+ def default
+ render_with_template
+ end
+ end
+end
diff --git a/lookbook/previews/patterns/layout_preview/default.html.erb b/lookbook/previews/patterns/layout_preview/default.html.erb
new file mode 100644
index 00000000000..e11b3f0de6d
--- /dev/null
+++ b/lookbook/previews/patterns/layout_preview/default.html.erb
@@ -0,0 +1,40 @@
+<%=
+ render(Primer::Alpha::Layout.new) do |component|
+ component.with_main do
+ "Main content"
+ end
+ component.with_sidebar(row_placement: :start, col_placement: :end) do
+ render(Primer::OpenProject::SidePanel.new) do |panel|
+ panel.with_section do |section|
+ section.with_title { "Attributes" }
+ section.with_counter(count: 5)
+ section.with_description do
+ "Attached files are available to all meeting participants. You can also drag and drop these into agenda item notes."
+ end
+
+ section.with_action_icon(icon: :pencil, 'aria-label': 'Edit')
+ section.with_footer_button(tag: :a, href: '#') do |button|
+ button.with_leading_visual_icon(icon: :pencil)
+ "Additional action"
+ end
+
+ "Section content"
+ end
+
+ panel.with_section do |section|
+ section.with_title { "Without counter" }
+ section.with_action_icon(icon: :gear, 'aria-label': 'Manage')
+
+ "Some more content here"
+ end
+
+ panel.with_section do |section|
+ section.with_title { "Without action" }
+
+ "Even more content here"
+ end
+ end
+
+ end
+ end
+%>