TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/iwinser117/react-portafolio/llms.txt
Use this file to discover all available pages before exploring further.
Nav component is the primary navigation bar for the Hector Portfolio. It sits fixed at the top of every page, hides gracefully as the user scrolls down, reappears on scroll-up, and conditionally renders links based on the current route. It also hosts the SettingsButton, which opens a slide-in panel for toggling dark/light mode and switching between English and Spanish.
Source File
src/components/Nav.jsx
What It Renders
Nav outputs a Bootstrap navbar containing three areas:
| Area | Content |
|---|---|
| Left | Logo image — dark or light variant based on useDarkMode() |
| Centre | Conditional nav links and anchor links |
| Right | SettingsButton (gear icon + modal panel) |
Logo — Dark / Light Mode
The logo asset is swapped at runtime using theuseDarkMode() hook from DarkModeProvider:
Despite their variable names,
logowhite (ok.svg) is rendered in light mode and logoblack (ok_white_bgsvg.svg) is rendered in dark mode. The variable names reflect the logo’s own background colour, not the site theme. Always rely on the isDarkMode boolean to determine which asset is active.Nav Links
Links are rendered conditionally to avoid showing the active route as a clickable item. React Router’suseLocation() provides the current path.
Home
Route:
Rendered with
Hidden when
Icon:
/Rendered with
<NavLink to="/">.Hidden when
location.pathname === "/".Icon:
FaHomeSkills
Anchor:
Rendered as
Hidden when on
Icon:
#habilidadesRendered as
<a href="#habilidades">.Hidden when on
/aplicaciones or /blog.Icon:
FaBrainApplications
Route:
Rendered with
Hidden when
Icon:
/aplicacionesRendered with
<NavLink to="/aplicaciones">.Hidden when
location.pathname === "/aplicaciones".Icon:
FaLaptopCodeContact me
Anchor:
Rendered as
Always visible on every route.
Icon:
#contactameRendered as
<a href="#contactame">.Always visible on every route.
Icon:
FaEnvelopeBlog
Route:
Rendered as
Hidden when
Icon:
/blogRendered as
<a href="/blog">.Hidden when
location.pathname === "/blog".Icon:
FaBlogSettingsButton
Always visible.
Opens a slide-in modal for theme and language settings.
No i18n key — icon only in the navbar.
Opens a slide-in modal for theme and language settings.
No i18n key — icon only in the navbar.
Icons
All nav icons are imported from thereact-icons/fa package:
FaUser is imported but not currently used in any rendered nav item. It is available for future use, for example an “About me” link.Scroll Hide / Show Behaviour
The navbar hides by sliding up totop: -50px when the user scrolls down, and slides back to top: 0 when the user scrolls up. This is implemented inside a useEffect that attaches to window’s scroll event.
useEffect dependency array contains location.pathname, so the listener is re-registered (and the page scrolls back to top) whenever the route changes. The cleanup function ensures no duplicate listeners accumulate.
CSS — @styles/Nav.css
Key rules from Nav.css:
| Rule | Purpose |
|---|---|
#navbar { position: fixed; top: 0; height: 50px; } | Pins navbar to the top of the viewport |
transition: background-color 0.12s ease-in-out | Smooth dark/light colour transition on all nav elements |
.nav-ul { height: 40px; display: flex; align-items: center; } | Horizontal link strip on desktop |
.dark-mode #navbar { background-color: #1D232A; } | Dark mode background |
@media (max-width: 799px) | Collapses to Bootstrap toggler; #n2 becomes full-width fixed |
.nav-settings-item { margin-left: auto; } | Pushes SettingsButton to the far right |
Responsive Breakpoints
| Breakpoint | Behaviour |
|---|---|
≥ 1200 px | Full horizontal navbar; .nav-ul is 90 % wide, centred |
800 – 1199 px | Full horizontal navbar; toggler hidden via CSS |
≤ 799 px | Bootstrap collapsible; toggler visible; links stack vertically |
i18n Keys
Text labels are loaded viareact-i18next using the t() function. The English values (from src/locales/en.json) are:
src/locales/en.json (English) and src/locales/es.json (Spanish).
Bootstrap Classes Reference
| Class | Element | Purpose |
|---|---|---|
navbar | <nav> | Bootstrap base navbar styles |
navbar-expand-lg | <nav> | Collapse on screens below lg (992 px) |
container-fluid | Inner <div> | Full-width flex container |
navbar-toggler | <button> | Hamburger button for mobile |
collapse navbar-collapse | Link wrapper | Collapsible link area |
navbar-nav nav-ul | <ul> | Flex list of nav items |
Customisation
Add a new nav link
Add a new
<li className="nav-item"> inside the <ul className="navbar-nav nav-ul"> block in Nav.jsx. Import the desired react-icons/fa icon at the top of the file.Add route-aware hiding
Wrap the new
<li> in a conditional: {location.pathname === "/your-route" ? null : ( <li>...</li> )} so the link disappears when the user is already on that page.Add the i18n key
Add the key to
src/locales/en.json under the "nav" object, and add the Spanish equivalent in src/locales/es.json.