Skip to content

Commit

Permalink
fix: add census link in explorer (#625)
Browse files Browse the repository at this point in the history
* add census link in explorer

* add + style divider

* change component declaration

* rm duplicate components

* manually update e2e test

* update to include two backslashes

---------

Co-authored-by: Joyce Yan <[email protected]>
  • Loading branch information
joyceyan and Joyce Yan authored Jun 21, 2023
1 parent 2d35450 commit 202a90f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/__tests__/e2e/__snapshots__/e2e.test.ts.snap

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion client/src/analytics/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export enum EVENTS {
EXPLORER_GENE_INFO_BUTTON_CLICKED = "EXPLORER_GENE_INFO_BUTTON_CLICKED",
WMG_CLICK_NAV = "WMG_CLICK_NAV",
COLLECTIONS_CLICK_NAV = "COLLECTIONS_CLICK_NAV",
CENSUS_CLICK_NAV = "CENSUS_CLICK_NAV",
DATASETS_CLICK_NAV = "DATASETS_CLICK_NAV",
DOCUMENTATION_CLICK_NAV = "DOCUMENTATION_CLICK_NAV"
DOCUMENTATION_CLICK_NAV = "DOCUMENTATION_CLICK_NAV",
}
5 changes: 5 additions & 0 deletions client/src/components/NavBar/components/NavDivider/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from "react";
import { NavDivider as Divider } from "./style";

const NavDivider = () => <Divider flexItem orientation="vertical" />;
export default NavDivider;
12 changes: 12 additions & 0 deletions client/src/components/NavBar/components/NavDivider/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Divider } from "@material-ui/core";
import { CommonThemeProps, getColors } from "czifui";
import styled from "@emotion/styled";

const gray500 = (props: CommonThemeProps) => getColors(props)?.gray[500];

export const NavDivider = styled(Divider)`
background-color: ${gray500};
border: none;
width: 1px;
height: inherit;
`;
17 changes: 17 additions & 0 deletions client/src/components/NavBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ import { EVENTS } from "../../analytics/events";
import { ROUTES } from "./routes";
import Icon from "../icon/icon";
import { Left, LinkWrapper, MainWrapper, Nav, Right, Wrapper } from "./style";
import NavDivider from "./components/NavDivider";

function handleMenuClick() {
track(EVENTS.EXPLORER_MENU_BUTTON_CLICKED);
}

const CENSUS_LINK = "https://cellxgene-census.readthedocs.io/en/latest";

interface HeaderProps {
tosURL?: string;
privacyURL?: string;
Expand Down Expand Up @@ -72,6 +75,17 @@ const Header = (props: HeaderProps) => {
onClick={handleWMGClick}
/>
</LinkWrapper>
<NavDivider />
<LinkWrapper>
<AnchorButton
href={CENSUS_LINK}
minimal
onClick={handleCensusClick}
rel="noopener"
target="_self"
text="Census"
/>
</LinkWrapper>
</Nav>
</Left>
<Right>
Expand Down Expand Up @@ -149,6 +163,9 @@ const Header = (props: HeaderProps) => {
function handleCollectionsClick(): void {
track(EVENTS.COLLECTIONS_CLICK_NAV);
}
function handleCensusClick(): void {
track(EVENTS.CENSUS_CLICK_NAV);
}
function handleDocumentationClick(): void {
track(EVENTS.DOCUMENTATION_CLICK_NAV);
}
Expand Down

0 comments on commit 202a90f

Please sign in to comment.