Skip to content

Commit

Permalink
fix(header): Display expanded or sticked header
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Nov 8, 2024
1 parent f016d1f commit f83e5f0
Show file tree
Hide file tree
Showing 11 changed files with 487 additions and 473 deletions.
5 changes: 4 additions & 1 deletion client/src/layout/header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export default function Header({ isSticky }) {
);
}

Header.defaultProps = {
isSticky: false,
};
Header.propTypes = {
isSticky: PropTypes.bool.isRequired,
isSticky: PropTypes.bool,
};
9 changes: 1 addition & 8 deletions client/src/layout/index.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import { Container } from '@dataesr/dsfr-plus';
import PropTypes from 'prop-types';
import { Outlet } from 'react-router-dom';

import Footer from './footer';
import Header from './header';

export default function Layout({ isSticky }) {
export default function Layout() {
return (
<>
{/* <Header isSticky={isSticky} /> */}
<Container fluid as="main" role="main">
<Outlet />
</Container>
<Footer />
</>
);
}

Layout.propTypes = {
isSticky: PropTypes.bool.isRequired,
};
2 changes: 2 additions & 0 deletions client/src/pages/datasets/results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Datasets from '../views/datasets';

import 'primereact/resources/primereact.min.css';
import 'primereact/resources/themes/lara-light-indigo/theme.css';
import Header from '../../layout/header';

const {
VITE_APP_NAME,
Expand Down Expand Up @@ -119,6 +120,7 @@ export default function Affiliations() {

return (
<>
<Header isSticky />
<Container fluid as="section" className="filters sticky">
<Row verticalAlign="top" className="fr-p-1w">
<Ribbon />
Expand Down
2 changes: 2 additions & 0 deletions client/src/pages/datasets/search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useEffect, useState } from 'react';
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';

import TagInput from '../../components/tag-input';
import Header from '../../layout/header';
import { getRorData, isRor } from '../../utils/ror';

const { VITE_APP_TAG_LIMIT } = import.meta.env;
Expand Down Expand Up @@ -213,6 +214,7 @@ export default function Search() {

return (
<>
<Header />
<Modal isOpen={isOpen} hide={() => setIsOpen(false)} size="xl">
<ModalContent>
<Container as="section" className="filters fr-my-5w">
Expand Down
36 changes: 20 additions & 16 deletions client/src/pages/home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,31 @@ import DatasetsTile from '../components/tiles/datasets';
import MentionsTile from '../components/tiles/mentions';
import OpenalexTile from '../components/tiles/openalex';
import PublicationsTile from '../components/tiles/publications';
import Header from '../layout/header';
import { isInProduction } from '../utils/helpers';

export default function Home() {
return (
<Container as="section" className="fr-mt-4w">
<Row gutters className="fr-mb-16w">
<Col sm={12} md={4}>
<OpenalexTile />
</Col>
<Col sm={12} md={4}>
<PublicationsTile />
</Col>
<Col sm={12} md={4}>
<DatasetsTile />
</Col>
{!isInProduction() && (
<>
<Header />
<Container as="section" className="fr-mt-4w">
<Row gutters className="fr-mb-16w">
<Col sm={12} md={4}>
<MentionsTile />
<OpenalexTile />
</Col>
)}
</Row>
</Container>
<Col sm={12} md={4}>
<PublicationsTile />
</Col>
<Col sm={12} md={4}>
<DatasetsTile />
</Col>
{!isInProduction() && (
<Col sm={12} md={4}>
<MentionsTile />
</Col>
)}
</Row>
</Container>
</>
);
}
Loading

0 comments on commit f83e5f0

Please sign in to comment.