diff --git a/src/components/ProjectStatus/ProjectStatus.scss b/src/components/ProjectStatus/ProjectStatus.scss index befcfc794..d401b05b9 100644 --- a/src/components/ProjectStatus/ProjectStatus.scss +++ b/src/components/ProjectStatus/ProjectStatus.scss @@ -178,6 +178,11 @@ $status-height: 20px; z-index: 2; transition: 250ms all; + &.dropdown-up { + top: auto; + bottom: 0; + } + .status-header { @include roboto-medium; font-size: $tc-label-md; diff --git a/src/components/ProjectStatus/editableProjectStatus.js b/src/components/ProjectStatus/editableProjectStatus.js index dd07c888c..5fe45d40c 100644 --- a/src/components/ProjectStatus/editableProjectStatus.js +++ b/src/components/ProjectStatus/editableProjectStatus.js @@ -11,6 +11,68 @@ import { PROJECT_STATUS_CANCELLED } from '../../config/constants' +const hocStatusDropdown = (CompositeComponent) => { + class StatusDropdown extends Component { + shouldDropdownUp() { + if (this.refs.dropdown) { + const bounds = this.refs.dropdown.getBoundingClientRect() + const windowHeight = window.innerHeight + + return bounds.top > windowHeight / 2 + } + + return false + } + + render() { + const { canEdit, isOpen, handleClick, onItemSelect, showText, withoutLabel, unifiedHeader, status } = this.props + const selected = PROJECT_STATUS.filter((opt) => opt.value === status)[0] + + this.shouldDropdownUp() + return ( +