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

Invert EE banner images in dark mode

Henriette Darge4b4d0ac90a5b
diff --git a/app/components/enterprise_edition/banner_component.html.erb b/app/components/enterprise_edition/banner_component.html.erb
index db2499efcb8..58db2231c33 100644
--- a/app/components/enterprise_edition/banner_component.html.erb
+++ b/app/components/enterprise_edition/banner_component.html.erb
@@ -1,8 +1,9 @@
<%=
component_wrapper(tag: "turbo-frame") do
- grid_layout("op-enterprise-banner",
- **@system_arguments) do |grid|
-
+ grid_layout(
+ "op-enterprise-banner",
+ **@system_arguments
+ ) do |grid|
if inline?
grid.with_area(:visual) do
render(Primer::Beta::Octicon.new(icon: :"op-enterprise-addons", classes: "op-enterprise-banner--icon"))
@@ -15,9 +16,13 @@
if medium?
flex_layout(align_items: :center, mb: 3) do |title_flex|
title_flex.with_column do
- render(Primer::Beta::Octicon.new(icon: :"op-enterprise-addons",
- size: :medium,
- classes: "upsell-colored"))
+ render(
+ Primer::Beta::Octicon.new(
+ icon: :"op-enterprise-addons",
+ size: :medium,
+ classes: "upsell-colored"
+ )
+ )
end
title_flex.with_column(ml: 2) do
@@ -36,7 +41,7 @@
if features.present?
flex.with_row do
- content_tag(:ul) { safe_join features.map { |text| render(Primer::Beta::Text.new(tag: :li)) { text } } }
+ content_tag(:ul) { safe_join(features.map { |text| render(Primer::Beta::Text.new(tag: :li)) { text } }) }
end
end
@@ -46,6 +51,10 @@
end
end
+ if medium?
+ grid.with_area(:image, **@image_arguments)
+ end
+
if @dismissable
grid.with_area(:dismiss) do
classes = medium? ? "op-enterprise-banner--close-icon_hovering" : ""
diff --git a/app/components/enterprise_edition/banner_component.rb b/app/components/enterprise_edition/banner_component.rb
index b95589ec9dd..22f00940ec5 100644
--- a/app/components/enterprise_edition/banner_component.rb
+++ b/app/components/enterprise_edition/banner_component.rb
@@ -89,10 +89,8 @@ module EnterpriseEdition
end
def before_render
- @system_arguments[:style] = join_style_arguments(
- @system_arguments[:style],
- medium? ? "background-image: url(#{helpers.image_path(@image)})" : nil
- )
+ @image_arguments = {}
+ @image_arguments[:style] = @image.present? ? "background-image: url(#{helpers.image_path(@image)})" : nil
end
def medium?
diff --git a/app/components/enterprise_edition/banner_component.sass b/app/components/enterprise_edition/banner_component.sass
index 3a1358c185b..776e6108ad4 100644
--- a/app/components/enterprise_edition/banner_component.sass
+++ b/app/components/enterprise_edition/banner_component.sass
@@ -43,34 +43,28 @@ $op-enterprise-banner-fixed-height: 220px
overflow: hidden
&_medium
+ position: relative
padding: 0
grid-template-areas: "content graphic"
grid-template-columns: 2fr 1fr
height: $op-enterprise-banner-fixed-height
- background-repeat: no-repeat
- background-position: center right
@media screen and (max-width: $breakpoint-lg)
grid-template-columns: 1fr
- background-image: none !important
height: auto
- @media screen and (max-width: $breakpoint-xl)
- background-size: cover
-
&_medium &
padding: 0
grid-template-areas: "content graphic"
grid-template-columns: 1fr 1fr
&--content
+ z-index: 1
align-self: center
padding: var(--base-size-16)
&--image
- width: 100%
- height: 100%
- object-fit: cover
+ @include upsell-image
&--visual
display: grid
diff --git a/app/views/homescreen/blocks/_upsell.html.erb b/app/views/homescreen/blocks/_upsell.html.erb
index f2e6a016a0e..a7ebc34761e 100644
--- a/app/views/homescreen/blocks/_upsell.html.erb
+++ b/app/views/homescreen/blocks/_upsell.html.erb
@@ -1,12 +1,15 @@
-<div class="widget-box--blocks--upsell-container"
- style="background-image: url(<%= image_path("enterprise/homescreen.png") %>)">
+<div class="widget-box--blocks--upsell-container">
<div class="widget-box--blocks--upsell-text">
<%=
render(Primer::OpenProject::FlexLayout.new(align_items: :center, mb: 3)) do |title_flex|
title_flex.with_column do
- render(Primer::Beta::Octicon.new(icon: :"op-enterprise-addons",
- size: :medium,
- classes: "upsell-colored"))
+ render(
+ Primer::Beta::Octicon.new(
+ icon: :"op-enterprise-addons",
+ size: :medium,
+ classes: "upsell-colored"
+ )
+ )
end
title_flex.with_column(ml: 2) do
@@ -21,6 +24,9 @@
<p class="widget-box--blocks--upsell-description">
<%= t("ee.upsell.homescreen_subline") %>
</p>
+
+ <%= render EnterpriseEdition::UpsellButtonsComponent.new(nil) %>
</div>
- <%= render EnterpriseEdition::UpsellButtonsComponent.new(nil) %>
+ <div class="widget-box--blocks--upsell-image"
+ style="background-image: url(<%= image_path("enterprise/homescreen.png") %>)"></div>
</div>
diff --git a/frontend/src/global_styles/content/_enterprise.sass b/frontend/src/global_styles/content/_enterprise.sass
index 7b8f7c7b6ed..8f1790b2ff0 100644
--- a/frontend/src/global_styles/content/_enterprise.sass
+++ b/frontend/src/global_styles/content/_enterprise.sass
@@ -23,17 +23,9 @@
background: var(--body-background)
.widget-box--blocks--upsell-container
+ position: relative
padding: 20px
height: 250px
- background-size: contain
- background-repeat: no-repeat
- background-position: center right
-
- @media screen and (max-width: $breakpoint-lg)
- background-image: none !important
-
- @media screen and (max-width: $breakpoint-xl)
- background-size: cover
.upsell-colored
color: var(--enterprise-upsell-color) !important
@@ -49,15 +41,16 @@
display: flex
.widget-box--blocks--upsell-text
- width: 50%
+ width: 60%
+ position: relative
+ z-index: 1
@media screen and (max-width: $breakpoint-lg)
width: 100%
+.widget-box--blocks--upsell-image
+ @include upsell-image
+
.widget-box--blocks--upsell-description
margin: 10px 0 10px 0
display: flex
-
-.widget-box--blocks--upsell-image
- width: 200px
- margin: auto
diff --git a/frontend/src/global_styles/openproject/_mixins.sass b/frontend/src/global_styles/openproject/_mixins.sass
index e887ca885dc..9b3d634e880 100644
--- a/frontend/src/global_styles/openproject/_mixins.sass
+++ b/frontend/src/global_styles/openproject/_mixins.sass
@@ -346,3 +346,23 @@ $scrollbar-size: 10px
@mixin op-uc-table-header-styles
border-color: var(--borderColor-default)
background-color: var(--bgColor-muted)
+
+@mixin upsell-image
+ position: absolute
+ left: 0
+ right: 0
+ top: 0
+ bottom: 0
+ background-repeat: no-repeat
+ background-position: center right
+ background-size: contain
+
+ @media screen and (max-width: $breakpoint-lg)
+ background-image: none !important
+
+ @media screen and (max-width: $breakpoint-xl)
+ background-size: cover
+
+ body[data-color-mode="dark"] &
+ filter: invert(100%)
+ -webkit-filter: invert(100%)