Skip to content

Commit

Permalink
CHAL-16: Fixed page height
Browse files Browse the repository at this point in the history
  • Loading branch information
noreen1423 committed Jul 26, 2024
1 parent 04612b9 commit 23de7a2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
1 change: 0 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ const config: StorybookConfig = {
babel: {
presets: ['next/babel'],
},

};
export default config;
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ describe('PageContainer', () => {
const { container } = render(<PageContainer />);
expect(container).toMatchSnapshot();
});
it('applies the correct min-height style.', () => {
const { getByTestId } = render(<PageContainer />);
const pageContainer = getByTestId('page-container');
const navbarHeight = '57px';
const footerHeight = '60px'; //footer padding 30x top and bottom
const expectedMinHeight = `calc(100vh - ${navbarHeight} - ${footerHeight})`;

expect(pageContainer).toHaveStyle(`min-height: ${expectedMinHeight}`);
});
});
2 changes: 1 addition & 1 deletion src/components/utils/page-container/page-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import styles from './styles.module.scss';
*/
export function PageContainer({ children }: PropsWithChildren) {
return (
<div className={styles.outer_container}>
<div className={styles.outer_container} data-testid="page-container">
<div className={styles.inner_container}>{children}</div>
</div>
);
Expand Down
4 changes: 3 additions & 1 deletion src/components/utils/page-container/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
display: flex;
justify-content: center;
width: 100%;
height: 100%;
//height: 100%;
//Calculate minimum height of the page
min-height: calc(100vh - #{partials.$navigation-height} - 60px);
margin-top: partials.$navigation-height;
min-width: partials.$page-width-min;
z-index: 0;
Expand Down
3 changes: 2 additions & 1 deletion src/styles/partials/variables/_navigation.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
$height: 57px;
$height: 57px;
//@forward 'navigation'

0 comments on commit 23de7a2

Please sign in to comment.