Skip to content

Commit

Permalink
feat: add banner to dev to indicate it is a dev site (#3147)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fran McDade authored and Fran McDade committed Nov 8, 2024
1 parent 616db52 commit 1c9ea35
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Banner {...props}>
<span>This is a development site. To view the production site, please visit https://anvilproject.org/.</span>
</Banner>
1 change: 1 addition & 0 deletions components/Layout/components/Header/content/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as DevelopmentModeBanner } from "./developmentModeBanner.mdx";
1 change: 1 addition & 0 deletions components/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { Alert } from "@databiosphere/findable-ui/lib/components/common/Alert/alert";
export { AnchorLink } from "@databiosphere/findable-ui/lib/components/common/AnchorLink/anchorLink";
export { Banner } from "@databiosphere/findable-ui/lib/components/common/Banner/banner";
export { Breadcrumbs } from "@databiosphere/findable-ui/lib/components/common/Breadcrumbs/breadcrumbs";
export { CallToActionButton } from "@databiosphere/findable-ui/lib/components/common/Button/components/CallToActionButton/callToActionButton";
export { Card } from "@databiosphere/findable-ui/lib/components/common/Card/card";
Expand Down
11 changes: 11 additions & 0 deletions mdx-components.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { MDXComponents } from "mdx/types";
import * as C from "./components";
import { Link } from "./components/common/Link/link";

export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...components,
Banner: C.Banner,
a: Link,
};
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"@mui/icons-material": "^6.1.5",
"@mui/material": "^6.1.5",
"@next/mdx": "^14.1.0",
"@types/mdx": "^2.0.11",
"copy-to-clipboard": "3.3.1",
"echarts": "^5.3.3",
"echarts-for-react": "^3.0.2",
Expand All @@ -45,6 +44,7 @@
"@mui/types": "^7.2.18",
"@next/eslint-plugin-next": "^14.1.0",
"@types/jest": "^29.4.0",
"@types/mdx": "^2.0.11",
"@types/node": "^20.10.0",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
Expand Down
15 changes: 15 additions & 0 deletions site-config/anvil-portal/dev/announcements/announcements.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ALERT_PROPS } from "@databiosphere/findable-ui/lib/components/common/Banner/constants";
import {
ComponentConfig,
ComponentsConfig,
} from "@databiosphere/findable-ui/lib/config/entities";
import * as MDX from "../../../../components/Layout/components/Header/content";

export const announcements: ComponentsConfig = [
{
component: MDX.DevelopmentModeBanner,
props: {
...ALERT_PROPS,
},
} as ComponentConfig<typeof MDX.DevelopmentModeBanner>,
];
2 changes: 2 additions & 0 deletions site-config/anvil-portal/dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as C from "../../../components";
import { ROUTES } from "../../../routes/constants";
import { FLATTEN, VISIBLE } from "../../common/constants";
import { SiteConfig } from "../../common/entities";
import { announcements } from "./announcements/announcements";
import { buildMenuItems } from "./common/utils";
import { CONSORTIA } from "./navigation/consortia";
import { FAQ } from "./navigation/faq";
Expand Down Expand Up @@ -47,6 +48,7 @@ export function makeConfig(browserUrl: string, portalUrl: string): SiteConfig {
socials: socialMedia.socials,
},
header: {
announcements,
authenticationEnabled: false,
logo: C.Logo({
alt: APP_TITLE,
Expand Down
4 changes: 4 additions & 0 deletions site-config/anvil-portal/prod/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ const config: SiteConfig = {
},
};

if (config.layout.header.announcements) {
config.layout.header.announcements = undefined;
}

export default config;

0 comments on commit 1c9ea35

Please sign in to comment.