Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
FIXUP fully calculate sidebar results size
Browse files Browse the repository at this point in the history
  • Loading branch information
jwalgran committed Jul 31, 2019
1 parent 2952bdf commit abdafcf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/app/src/components/FilterSidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class FilterSidebar extends Component {
} = this.props;

const header = (
<div className="panel-header">
<div className="panel-header results-height-subtract">
<h3 className="panel-header__title">
Open Apparel Registry
</h3>
Expand All @@ -106,7 +106,7 @@ class FilterSidebar extends Component {
};

const tabBar = (
<AppBar position="static">
<AppBar position="static" className="results-height-subtract">
<Tabs
value={activeTabIndex}
onChange={handleTabChange}
Expand Down
17 changes: 6 additions & 11 deletions src/app/src/components/FilterSidebarFacilitiesTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
import Divider from '@material-ui/core/Divider';
import get from 'lodash/get';
import sum from 'lodash/sum';
import { toast } from 'react-toastify';
import InfiniteAnyHeight from 'react-infinite-any-height';

Expand Down Expand Up @@ -215,7 +214,7 @@ function FilterSidebarFacilitiesTab({
const RegisterLink = props => <Link to={authRegisterFormRoute} {...props} />;

const listHeaderInsetComponent = (
<div style={facilitiesTabStyles.listHeaderStyles}>
<div style={facilitiesTabStyles.listHeaderStyles} className="results-height-subtract">
<Typography
variant="subheading"
align="center"
Expand Down Expand Up @@ -259,16 +258,12 @@ function FilterSidebarFacilitiesTab({
</div>
);

const componentSizes = [
64, // Navbar
107, // Sidebar heading
48, // Sidebar tabs
138, // Sidebar controls
51, // Footer
8, // Additional padding
];
const nonResultListComponentHeight = (
Array.from(document.getElementsByClassName('results-height-subtract'))
.reduce((sum, x) => sum + x.offsetHeight, 0)
);

const resultListHeight = windowHeight - sum(componentSizes);
const resultListHeight = windowHeight - nonResultListComponentHeight;

return (
<Fragment>
Expand Down
2 changes: 1 addition & 1 deletion src/app/src/components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const links = [
];

export default () => (
<footer className="footerContainer" xs={12}>
<footer className="footerContainer results-height-subtract" xs={12}>
<div className="links">
{links.map((l) => {
if (l.external && 'prefix' in l) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function Navbar() {
];

return (
<AppBar position="static" className="App-header">
<AppBar position="static" className="App-header results-height-subtract">
<Toolbar style={{ padding: 0 }}>
<div style={{ display: 'flex', justifyContent: 'middle' }}>
<Link
Expand Down

0 comments on commit abdafcf

Please sign in to comment.