Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Content Message for Empty Product Backlog #29

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.noContentMsg {
position: absolute;
display: grid;
top: 0;
left: 0;
right: 0;
bottom: 0;
font-size: 1.2rem;
padding: 1.5rem;
}

:global(.mobile) .noContentMsg {
text-align: center;
}
19 changes: 19 additions & 0 deletions packages/shared/src/components/atoms/text/NoContentMessage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// externals
import * as React from "react";

// style
import css from "./NoContentMessage.module.css";

/* exported interfaces/types */

export type NoContentMessageStateProps = React.PropsWithChildren<Record<never, any>>;

export type NoContentMessageDispatchProps = {};

export type NoContentMessageProps = NoContentMessageStateProps & NoContentMessageDispatchProps;

/* exported components */

export const NoContentMessage: React.FC<NoContentMessageProps> = (props) => {
return <div className={css.noContentMsg}>{props.children}</div>;
};
1 change: 1 addition & 0 deletions packages/shared/src/components/atoms/text/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./NoContentMessage";
export * from "./SimpleText";
9 changes: 9 additions & 0 deletions packages/shared/src/components/common/base.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
Purpose: This is for use in the components and should only contain VERY
common CSS that's used in a lot of them. This is not the file for CSS
that's "global" in nature but used in a small subset of files. At
present there isn't a file for that purpose but the guidance is that you
should try to create components to encapsulate the common style rather
than making the styles "global".
*/

.fill {
fill: var(--normal-pen-color, black);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
buildDividerKey
} from "../../../molecules/cards/BacklogItemCard";
import { SimpleDivider } from "../../../atoms/dividers/SimpleDivider";
import { NoContentMessage } from "../../../atoms/text/NoContentMessage";

// consts/enums
import { EditMode } from "../../../common/componentEnums";
Expand Down Expand Up @@ -567,6 +568,9 @@ export const InnerProductPlanningPanel: React.FC<ProductPlanningPanelProps> = (p
}
return null;
};
if (renderElts.length === 0) {
renderElts.push(<NoContentMessage>The product backlog is empty. To add content click the Edit button!</NoContentMessage>);
}
return (
<div
ref={ref}
Expand Down
15 changes: 0 additions & 15 deletions packages/shared/src/views/PlanView.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,3 @@
height: 100%;
display: flex;
}

.noContentMsg {
position: absolute;
display: grid;
top: 0;
left: 0;
right: 0;
bottom: 0;
font-size: 1.2rem;
padding: 1.5rem;
}

:global(.mobile) .noContentMsg {
text-align: center;
}
3 changes: 2 additions & 1 deletion packages/shared/src/views/PlanView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { SprintPlanningPanel } from "../components/organisms/panels/sprintPlanni
import { SmartSpinner } from "../components/molecules/unique/smartSpinner/SmartSpinner";
import { BottomPanelContainer } from "../containers/BottomPanelContainer";
import { ContentPanel } from "../components/organisms/panels/ContentPanel";
import { NoContentMessage } from "../components/atoms/text/NoContentMessage";

// contexts
import { AppContext } from "../contexts/appContextUtil";
Expand Down Expand Up @@ -232,7 +233,7 @@ export class PlanView extends React.Component<PlanViewProps, {}> {
} else if (hasContent || this.props.editMode === EditMode.Edit) {
pageContent = pageContentsElts;
} else {
pageContent = <div className={css.noContentMsg}>This project is empty. To add content click the Edit button!</div>;
pageContent = <NoContentMessage>This project is empty. To add content click the Edit button!</NoContentMessage>;
}
return (
<>
Expand Down
Loading