diff --git a/src/commons/route/active-link.tsx b/src/commons/route/active-link.tsx new file mode 100644 index 0000000..ba05ea5 --- /dev/null +++ b/src/commons/route/active-link.tsx @@ -0,0 +1,20 @@ +import { ActiveHookProps, Link, LinkProps, useActive } from '@curi/react-dom'; +import React, { FC, ReactNode } from 'react'; + +export type ActiveLinkProps = ActiveHookProps & + LinkProps & { + className?: string; + children: ReactNode; + }; + +export const ActiveLink:FC = ({ name, params, partial, className = "", ...rest }) => { + const active = useActive({ name, params, partial }); + return ( + + ); +}; diff --git a/src/pipelines/pipeline-list.tsx b/src/pipelines/pipeline-list.tsx index c8c51eb..18f4b28 100644 --- a/src/pipelines/pipeline-list.tsx +++ b/src/pipelines/pipeline-list.tsx @@ -3,7 +3,6 @@ import { Link } from '@curi/react-dom'; import { List, ListItem, Typography, ListItemText } from '@material-ui/core'; import { FC } from 'react'; import { Pipeline } from '../generated/graphql'; -import { Fragment } from 'react'; import { CallMerge } from '@material-ui/icons'; interface Props { diff --git a/src/projects/project-panel.tsx b/src/projects/project-panel.tsx index 077544d..9f573e6 100644 --- a/src/projects/project-panel.tsx +++ b/src/projects/project-panel.tsx @@ -1,12 +1,12 @@ -import { gql, useQuery } from '@apollo/client'; -import { Link, useRouter } from '@curi/react-dom'; -import { Box, List, ListItem } from '@material-ui/core'; -import { find, propEq } from 'ramda'; -import React, { useState, FC, useEffect } from 'react'; -import { Project } from '../generated/graphql'; -import { ListItemText } from '@material-ui/core'; -import { Button } from '@material-ui/core'; -import { AddBox } from '@material-ui/icons'; +import { gql, useQuery } from "@apollo/client"; +import { Link } from "@curi/react-dom"; +import { Box, List, ListItem, makeStyles, Theme } from "@material-ui/core"; +import { FC } from "react"; +import { Project } from "../generated/graphql"; +import { ListItemText } from "@material-ui/core"; +import { Button } from "@material-ui/core"; +import { AddBox } from "@material-ui/icons"; +import { ActiveLink } from "../commons/route/active-link"; const PROJECTS = gql` query Projects { @@ -21,13 +21,31 @@ const PROJECTS = gql` } `; +const useStyles = makeStyles((theme: Theme) => ({ + item: { + position: "relative", + ".active &": { + backgroundColor: theme.palette.background.default, + }, + ".active &::before": { + position: "absolute", + top: 0, + bottom: 0, + left: 0, + content: '""', + display: "block", + borderLeftColor: theme.palette.secondary.main, + borderLeftWidth: 4, + borderLeftStyle: "solid", + }, + }, +})); + export function ProjectPanel() { return (
- +