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

4.0 KB
Raw Blame
//-- copyright
// OpenProject is an open source project management software.
// Copyright (C) the OpenProject GmbH
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License version 3.
//
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
// Copyright (C) 2006-2013 Jean-Philippe Lang
// Copyright (C) 2010-2013 the ChiliProject Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//
// See COPYRIGHT and LICENSE files for more details.
//++

@media screen and (max-width: $breakpoint-sm)
  body, html
    position: relative
    -webkit-overflow-scrolling: touch
    height: 100%

  #main
    margin-top: var(--header-height)

  ._header-scrolled
    #main
      margin-top: 0
    #main,
    #content-wrapper,
    #main-menu #menu-sidebar
      height: 100dvh

    #main .content-overlay
      top: 0 !important

  #content-body,
  #content-header
    padding-top: var(--main-menu-toggler-top-spacing)
    padding-left: 15px
    padding-right: 15px

  #content-body
    position: static

  .hidden-for-mobile
    display: none !important

  h2
    font-size: 1.4rem

  /*
   * This is a very ugly hack to make the PageHeader sticky on mobile.
   * The CSS sticky property relies on the direct parent element, see https://developer.mozilla.org/en-US/docs/Web/CSS/position#sticky
   * Unfortunately, the html structure differs from page to page. So we don't know which element to make sticky.
   * Therefore, we make all divs sticky between the content-header, (and for the older pages, the content-body) and the PageHeader itself.
   */
  #content-header div:has(page-header),
  #content-body div:has(page-header),
  page-header,
  .work-packages--show-view .toolbar-container
    position: sticky
    top: calc(var(--main-menu-toggler-top-spacing) * -1)
    z-index: var(--main-menu-toggler-z-index)
    background-color: var(--body-background)
    padding-top: var(--main-menu-toggler-top-spacing)
    margin-top: calc(var(--main-menu-toggler-top-spacing) * -1)

  // Hide the header, when the content-bodyRight is shown, because it has it's own header.
  // Otherwise, the sticky header would lay on top of the split screen
  #content:has(#content-bodyRight > *)
    page-header,
    sub-header
      display: none

  .work-packages--show-view .toolbar-container
    margin-bottom: 0
    .wp-show--header-container
      margin-bottom: 1rem
      // Add a border bottom on mobile so that the sticky header has a clear cut to the content
      border-bottom: var(--borderWidth-thin) solid var(--borderColor-muted)

@media screen and (min-width: $breakpoint-sm)
  .hidden-for-desktop
    display: none !important

@media screen and (max-width: $breakpoint-md)
  .hidden-for-tablet
    display: none !important

@media screen and (max-width: $breakpoint-lg)
  .hidden-for-small-laptops
    display: none !important

  #main
    grid-template-columns: auto

  #content:has(#content-bodyRight > *)
    grid-template-columns: 1fr auto

  // As soon as the split screen has content (so basically when its opened), it takes the available whole space
  #content-bodyRight:has(*)
    grid-column: 1 / 3
    grid-row: 1 / 3
    background-color: var(--body-background)
    z-index: 1

@media screen and (max-width: $breakpoint-lg) and (min-width: $breakpoint-sm)
  .hidden-for-tablet-and-small-laptops
    display: none !important