Skip to content

Commit

Permalink
Fix: Ensure Footer Visibility on Smaller Screens (#489)
Browse files Browse the repository at this point in the history
### Summary
#468 Issue
This pull request addresses an issue where the footer was not rendering
on smaller screens due to the d-none class. The visibility of the footer
is crucial for providing a seamless user experience across different
devices.

### Changes Made
- Removed the d-none class from the div in the footer folder index file,
enabling the footer to be visible on smaller screens.

### Why
The d-none class was unintentionally hiding the footer on smaller
screens, affecting the overall user experience. This change ensures
consistent visibility across all screen sizes. The d-none class in
Bootstrap is a utility class that sets an element to display: none!
important;, effectively hiding it.

### ScreenShots
**before**
![Screenshot 2024-02-25
163600](https://github.com/apertium/apertium-html-tools/assets/86158204/1d59046e-2041-436d-9986-f10baf35dce9)
**After**
![Screenshot 2024-02-25
163441](https://github.com/apertium/apertium-html-tools/assets/86158204/e115ded4-47ce-428e-b7fc-702ad2125242)

- Tested on various devices and screen sizes.
- Ensured the removal of the d-none class did not introduce any
unintended side effects.

This PR is ready for review. Your feedback is appreciated!
  • Loading branch information
thrishank committed Mar 13, 2024
1 parent ac973a9 commit 2d1d15e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/components/footer/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('Footer', () => {
it('opens about dialog on desktop', () => {
renderFooter();

userEvent.click(screen.getAllByRole('button', { name: 'Help_Improve-Default' })[1]);
userEvent.click(screen.getAllByRole('button', { name: 'Help_Improve-Default' })[0]);

expect(screen.getByRole('dialog').textContent).toMatchInlineSnapshot(
`"About_Apertium-Default×CloseWhat_Is_Apertium-DefaultApertium-Default"`,
Expand Down
62 changes: 33 additions & 29 deletions src/components/footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,37 @@ const FooterNav_ = ({
const { t } = useLocalization();

return (
<Nav as="ul" className="p-0" role="navigation" style={{ cursor: 'pointer' }} variant="pills">
<Nav.Item as="li">
<Nav.Link className="footer-link" onClick={() => setOpenTab(Tab.About)}>
<FontAwesomeIcon icon={faQuestionCircle} /> {t('About')}
</Nav.Link>
</Nav.Item>
<Nav.Item as="li">
<Nav.Link className="footer-link" onClick={() => setOpenTab(Tab.Download)}>
<FontAwesomeIcon icon={faDownload} /> {t('Download')}
</Nav.Link>
</Nav.Item>
<Nav.Item as="li">
<Nav.Link className="footer-link" onClick={() => setOpenTab(Tab.Documentation)}>
<FontAwesomeIcon icon={faBook} /> {t('Documentation')}
</Nav.Link>
</Nav.Item>
<Nav.Item as="li">
<Nav.Link className="footer-link" onClick={() => setOpenTab(Tab.Contact)}>
<FontAwesomeIcon icon={faEnvelope} /> {t('Contact')}
</Nav.Link>
</Nav.Item>
<Nav
as="ul"
className="p-2 flex-column flex-md-row"
role="navigation"
style={{ cursor: 'pointer' }}
variant="pills"
>
<div className="d-flex justify-content-between">
<Nav.Item as="li">
<Nav.Link className="footer-link" onClick={() => setOpenTab(Tab.About)}>
<FontAwesomeIcon icon={faQuestionCircle} /> {t('About')}
</Nav.Link>
</Nav.Item>
<Nav.Item as="li">
<Nav.Link className="footer-link" onClick={() => setOpenTab(Tab.Download)}>
<FontAwesomeIcon icon={faDownload} /> {t('Download')}
</Nav.Link>
</Nav.Item>
</div>
<div className="d-flex justify-content-between">
<Nav.Item as="li">
<Nav.Link className="footer-link" onClick={() => setOpenTab(Tab.Documentation)}>
<FontAwesomeIcon icon={faBook} /> {t('Documentation')}
</Nav.Link>
</Nav.Item>
<Nav.Item as="li">
<Nav.Link className="footer-link" onClick={() => setOpenTab(Tab.Contact)}>
<FontAwesomeIcon icon={faEnvelope} /> {t('Contact')}
</Nav.Link>
</Nav.Item>
</div>
</Nav>
);
};
Expand Down Expand Up @@ -95,7 +105,7 @@ const Footer = ({
<>
<div className="d-flex flex-column container" ref={footerRef}>
<div className="d-flex flex-column container">
<div className="d-none d-md-flex flex-wrap flex-row justify-content-between position-relative row">
<div className="d-md-flex flex-wrap flex-column flex-md-row justify-content-between position-relative row">
<FooterNav setOpenTab={setOpenTab} />

<div className="mb-4 d-flex flex-column">
Expand All @@ -106,7 +116,7 @@ const Footer = ({
</Button>
</div>
<a
className="text-muted d-none d-lg-block version align-self-end"
className="text-muted d-lg-block version align-self-end font-weigth-bold"
href="https://github.com/apertium/apertium-html-tools"
rel="noreferrer"
target="_blank"
Expand All @@ -115,12 +125,6 @@ const Footer = ({
</a>
</div>
</div>
<div className="align-self-end card card-body d-block bg-light d-md-none my-2 p-2">
<span>{t('Notice_Mistake')}</span>{' '}
<Button className="p-0" onClick={() => setOpenTab(Tab.About)} tabIndex={0} variant="link">
{t('Help_Improve')}
</Button>
</div>
</div>
</div>

Expand Down

0 comments on commit 2d1d15e

Please sign in to comment.