feat: hide project finder after selecting project

This commit is contained in:
Jordan Knott 2021-01-05 17:00:31 -06:00
parent b5744bcf22
commit ff15e7fb53

View File

@ -7,6 +7,7 @@ import theme from './ThemeStyles';
import ControlledInput from 'shared/components/ControlledInput'; import ControlledInput from 'shared/components/ControlledInput';
import { CaretDown, CaretRight } from 'shared/icons'; import { CaretDown, CaretRight } from 'shared/icons';
import useStickyState from 'shared/hooks/useStickyState'; import useStickyState from 'shared/hooks/useStickyState';
import { usePopup } from 'shared/components/PopupMenu';
const colors = [theme.colors.primary, theme.colors.secondary]; const colors = [theme.colors.primary, theme.colors.secondary];
@ -161,6 +162,7 @@ const ProjectFinder = () => {
const { loading, data } = useGetProjectsQuery({ fetchPolicy: 'cache-and-network' }); const { loading, data } = useGetProjectsQuery({ fetchPolicy: 'cache-and-network' });
const [search, setSearch] = useState(''); const [search, setSearch] = useState('');
const [minified, setMinified] = useStickyState<Array<string>>([], 'project_finder_minified'); const [minified, setMinified] = useStickyState<Array<string>>([], 'project_finder_minified');
const { hidePopup } = usePopup();
if (data) { if (data) {
const { teams } = data; const { teams } = data;
const projects = data.projects.filter(p => { const projects = data.projects.filter(p => {
@ -209,7 +211,7 @@ const ProjectFinder = () => {
<TeamProjects> <TeamProjects>
{team.projects.map((project, idx) => ( {team.projects.map((project, idx) => (
<TeamProjectContainer key={project.id}> <TeamProjectContainer key={project.id}>
<TeamProjectLink to={`/projects/${project.id}`}> <TeamProjectLink onClick={e => hidePopup()} to={`/projects/${project.id}`}>
<TeamProjectBackground idx={idx} /> <TeamProjectBackground idx={idx} />
<TeamProjectAvatar idx={idx} /> <TeamProjectAvatar idx={idx} />
<TeamProjectContent> <TeamProjectContent>