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

include life cycle type component in lookbook

ulferts65c917f7cac8
diff --git a/app/components/projects/life_cycle_type_component.html.erb b/app/components/projects/life_cycle_type_component.html.erb
index cb685a9ab71..728082531b7 100644
--- a/app/components/projects/life_cycle_type_component.html.erb
+++ b/app/components/projects/life_cycle_type_component.html.erb
@@ -1,5 +1,4 @@
-<%= flex_layout(align_items: :center,
- justify_content: :space_between) do |element_container|
+<%= flex_layout(align_items: :center) do |element_container|
element_container.with_column(mr: 1, classes: icon_color_class) do
render Primer::Beta::Octicon.new(icon: icon)
end
diff --git a/app/components/projects/life_cycle_type_component.rb b/app/components/projects/life_cycle_type_component.rb
index f6793e45b74..9ada0c43461 100644
--- a/app/components/projects/life_cycle_type_component.rb
+++ b/app/components/projects/life_cycle_type_component.rb
@@ -51,7 +51,10 @@ module Projects
end
def text_options
- { color: :muted, font_size: :small }.merge(options)
+ # The tag: :div is is a hack to fix the line height difference
+ # caused by font_size: :small. That line height difference
+ # would otherwise lead to the text being not on the same height as the icon
+ { color: :muted, font_size: :small, tag: :div }.merge(options)
end
end
end
diff --git a/lookbook/previews/open_project/projects/life_cycle_type_component_preview.rb b/lookbook/previews/open_project/projects/life_cycle_type_component_preview.rb
new file mode 100644
index 00000000000..dd73a64cc94
--- /dev/null
+++ b/lookbook/previews/open_project/projects/life_cycle_type_component_preview.rb
@@ -0,0 +1,14 @@
+module OpenProject
+ module Projects
+ # @logical_path OpenProject/Projects
+ class LifeCycleTypeComponentPreview < Lookbook::Preview
+ def gate
+ render_with_template(locals: { model: Gate.new(id: 1, name: "The first gate") })
+ end
+
+ def stage
+ render_with_template(locals: { model: Stage.new(id: 1, name: "The first stage") })
+ end
+ end
+ end
+end
diff --git a/lookbook/previews/open_project/projects/life_cycle_type_component_preview/gate.html.erb b/lookbook/previews/open_project/projects/life_cycle_type_component_preview/gate.html.erb
new file mode 100644
index 00000000000..442cbfcb2e3
--- /dev/null
+++ b/lookbook/previews/open_project/projects/life_cycle_type_component_preview/gate.html.erb
@@ -0,0 +1,6 @@
+<!-- Depends on having the color defined in the highlighting/styles.css.erb file. -->
+<style>
+ .__hl_inline_life_cycle_step_definition_1 { color: red; }
+</style>
+
+<%= render(::Projects::LifeCycleTypeComponent.new(model)) %>
diff --git a/lookbook/previews/open_project/projects/life_cycle_type_component_preview/stage.html.erb b/lookbook/previews/open_project/projects/life_cycle_type_component_preview/stage.html.erb
new file mode 100644
index 00000000000..442cbfcb2e3
--- /dev/null
+++ b/lookbook/previews/open_project/projects/life_cycle_type_component_preview/stage.html.erb
@@ -0,0 +1,6 @@
+<!-- Depends on having the color defined in the highlighting/styles.css.erb file. -->
+<style>
+ .__hl_inline_life_cycle_step_definition_1 { color: red; }
+</style>
+
+<%= render(::Projects::LifeCycleTypeComponent.new(model)) %>