forked from github/plane
b1592adc66
* dev: initialize new date picker * style: selected date focus state * chore: replace custom date filter modal components * chore: replaced inbox snooze popover datepicker * chore: replaced the custom date picker * style: date range picker designed * chore: date range picker implemented throughout the platform * chore: updated tab indices * chore: range-picker in the issue layouts * chore: passed due date color * chore: removed range picker from issue dates
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import { observer } from "mobx-react-lite";
|
|
import { ReactNode } from "react";
|
|
import { IIssueDisplayProperties } from "@plane/types";
|
|
|
|
interface IWithDisplayPropertiesHOC {
|
|
displayProperties: IIssueDisplayProperties;
|
|
shouldRenderProperty?: (displayProperties: IIssueDisplayProperties) => boolean;
|
|
displayPropertyKey: keyof IIssueDisplayProperties | (keyof IIssueDisplayProperties)[];
|
|
children: ReactNode;
|
|
}
|
|
|
|
export const WithDisplayPropertiesHOC = observer(
|
|
({ displayProperties, shouldRenderProperty, displayPropertyKey, children }: IWithDisplayPropertiesHOC) => {
|
|
let shouldDisplayPropertyFromFilters = false;
|
|
if (Array.isArray(displayPropertyKey))
|
|
shouldDisplayPropertyFromFilters = displayPropertyKey.every((key) => !!displayProperties[key]);
|
|
else shouldDisplayPropertyFromFilters = !!displayProperties[displayPropertyKey];
|
|
|
|
const renderProperty =
|
|
shouldDisplayPropertyFromFilters && (shouldRenderProperty ? shouldRenderProperty(displayProperties) : true);
|
|
|
|
if (!renderProperty) return null;
|
|
|
|
return <>{children}</>;
|
|
}
|
|
);
|