Skip to content

Commit

Permalink
ui: add optional white background to PageConfig
Browse files Browse the repository at this point in the history
Previously, the PageConfig component had a fixed grey
background to match the page background, since it is a sticky
component that needs a background color to cover content that
scrolls beneath it. However, the background color is changing
to white in CockroachCloud, so the background color needs to
be able to match the new background. Until we apply the layout
changes to `db-console`, this change allows us to specify a
different background color in CockroachCloud.

This change uses CockroachCloudContext to determine whether or
not the PageConfig background color should be white.

Release note: None

Release justification: ui change for cluster-ui components used
in cockroach cloud
  • Loading branch information
absterr08 committed Sep 6, 2022
1 parent 825e89e commit eb308cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
z-index: 2;
background-color: $colors--background;

&__white-background {
background-color: $colors--white
}

&__list {
display: flex;
justify-content: flex-start;
Expand Down
7 changes: 5 additions & 2 deletions pkg/ui/workspaces/cluster-ui/src/pageConfig/pageConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

import React from "react";
import React, { useContext } from "react";
import classnames from "classnames/bind";
import styles from "./pageConfig.module.scss";
import { CockroachCloudContext } from "../contexts";

export interface PageConfigProps {
layout?: "list" | "spread";
Expand All @@ -20,13 +21,15 @@ export interface PageConfigProps {
const cx = classnames.bind(styles);

export function PageConfig(props: PageConfigProps): React.ReactElement {
const isCockroachCloud = useContext(CockroachCloudContext);

const classes = cx({
"page-config__list": props.layout !== "spread",
"page-config__spread": props.layout === "spread",
});

return (
<div className={cx("page-config")}>
<div className={cx("page-config", { "page-config__white-background": isCockroachCloud })}>
<ul className={classes}>{props.children}</ul>
</div>
);
Expand Down

0 comments on commit eb308cd

Please sign in to comment.