Skip to content

Eemeli/enhancement/619 new header component implementation#632

Merged
Rutjake merged 26 commits intodevfrom
eemeli/enhancement/619-New-Header-Component-Implementation
Mar 18, 2026
Merged

Eemeli/enhancement/619 new header component implementation#632
Rutjake merged 26 commits intodevfrom
eemeli/enhancement/619-New-Header-Component-Implementation

Conversation

@EemeliJ
Copy link
Copy Markdown
Contributor

@EemeliJ EemeliJ commented Mar 6, 2026

📄 Pull Request Overview

Closes [619]

🔧 Changes Made

  1. [Briefly describe changes you made]
  • Implemented new Header v2 component with separate Desktop and Mobile layouts.
  • Integrated shared UI components (Button, Paragraph, SocialSection).
  • Added i18n support using useClientTranslation and existing translation keys.
  • Implemented responsive styling and layout improvements.
  • Added CTA navigation buttons with language-prefixed routes.
  • Fixed UI alignment issues (social icons, button layout, feedback button overlap)
  1. [Any refactoring or clean-up tasks]
  • Refactored the header implementation to use the v2 component structure, improved code organization, and reused existing shared components for consistency.

Checklist Before Submission

  • Functionality: I have tested my code, and it works as expected ✅
  • JSDoc: I have added or updated JSDoc comments for all relevant code ✅
  • Debugging: No console.log() or other debugging statements are left ✅
  • Clean Code: Removed commented-out or unnecessary code ✅
  • Tests: Added new tests or updated existing ones for the changes made ✅
  • Documentation: Documentation has been updated (if applicable) ✅

📝 Additional Information

Provide any additional context or information that reviewers may need to know:

  • Screenshots: [Include any screenshots or videos if the changes affect the UI]
desktop desktop-en desktop-ru mobile
  • Dependencies: No new dependencies were added.
  • Known Issues: No known functional issues. Minor visual adjustments may be needed based on future design updates.

@Skoivumaki Skoivumaki changed the base branch from main to dev March 6, 2026 14:46
@Skoivumaki
Copy link
Copy Markdown
Member

Switched base branch, may cause issues. "Pulled latest from main, and updated some styling" Main is not the latest, its our production branch.

Copy link
Copy Markdown
Member

@Skoivumaki Skoivumaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branch is failing to run currently due to: "Module not found: Can't resolve '@/shared/assets/images/mainpage/topimage.png" missing.
By your screenshots the new header looks solid 👍

I noticed you left a lot of comments that really don't add anything or feel like your personal notes. Please remove them to reduce bloat and make code more readable.

When you fix the build error, will review the visual side, but its probably fine 😄

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool, but why was it implemented and was its effects tested all around, since its handling root layout

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LayoutBackgroundController was introduced during the header refactor when the image on the homepage (topimage) was moved into the new Header component. At that stage the image caused visual conflicts with the global background texture rendered by LayoutWithBackground, especially on the main page where the image overlaps the layout background.

The controller was added as a client-side wrapper so that background behavior could be adjusted based on the route without converting RootLayout into a client component. This allowed using client routing logic if needed.

The layout has been tested with this structure and it works correctly across the site. Currently the controller only passes children to LayoutWithBackground, so it does not actively change behavior anymore.

This can be removed if necessary, but it is functioning correctly in this state.

* LayoutBackgroundController is a client wrapper for LayoutWithBackground.
*
* Purpose:
* - Allows controlling background behavior in a Client Component without converting RootLayout into a client component.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to control a background image?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally the goal was to allow conditional background rendering depending on the page. The homepage image (topimage) initially caused layout issues with the global background texture, so this was the solution at that point.

After further adjustments the layout now renders correctly with the background enabled everywhere. Because of that, the controller is no longer strictly required and can be removed if needed.

</head>
<body>
<LayoutWithBackground>
<LayoutBackgroundController lng={lng}>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are passing language parameters to a background controller? Do the tiles change color if in english? xd

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was originally passed so the controller could detect routes like /${lng} if we needed language aware background logic. This is not currently used and does not do anything, i will remove it as a small cleanup. Not sure why i thought this would be useful, i admit it is a bit odd :D

* @param imagePath - Path to the background image (defaults to main background)
* @param alt - Alt text for the background image (for accessibility)
* @param shouldBeLazyLoaded - Whether to lazy load the background image (not used with CSS background)
* Responsibilities:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this documentation too much? IMO good documentation should be kept brief enough to explain what each parameter or prop does. We don't need to tell the developer what the component should NOT be used for. Adding notes for developers is good too, but not when you are repeating what params do.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, removed unnecessary comments from this file.

* Notes:
* - Background visibility is controlled via `showBackground`.
* - This component is intended to be used at layout level.
* - Route-based background logic should be handled by a wrapper
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really route based though when the only route we are using is language? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, this is some leftover documentation from the earlier implementation, and will be removed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was fixing feedback button bug part of the issue? @Rutjake
"Implemented responsive styling and layout improvements." This is too broad to explain why this change was done. (we currently have an active bug fix issue, with similar z-index problems. The reason I'm mentioning this is, will this change affect those bug fixes too?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feedback button was rendered below the header in the stacking order when scrolling to the top, thus becoming unresponsive. The only changes i made was in the .SideButton (z-index: 1000 !important;) and the .FeedbackCardContainer (z-index: 1001;).

padding-top: 1rem;
justify-content: center;

/* Footer controls layout now (was previously inside SocialSection component) */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment could have worked really well as a commit message instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I will try to write more specific commit messages in the future.

const { className = '', socialIconLinks } = props;

const params = useParams();
const lng = (params?.lng as string) ?? 'fi';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the future: Page already defaults to finnish if no lng is provided, no need to add failsafes 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed WallIntroAnimation from mainpage but still made changes to the component? Feels like you were planning to use it, but for some reason didn't? Always explain your thought process in PR or by commits.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to WallIntroAnimation were made earlier to fix a DOM race condition and to properly handle timeout cleanup and localStorage usage.

During the header refactor the animation was removed from the MainPage because the new header layout replaced its role. The fixes were kept since the component might still be reused later and they prevent the previous runtime errors.

The intention was also to improve stability and performance, but I forgot to document that in the PR. Thanks for pointing it out 👍

@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/nextjs';
import { socialIconLinks } from '../../model/data/socialSectionMenu';
import { socialIconLinks } from '../../../../shared/const/socialSectionMenu';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do @/shared/const/socialSectionMenu instead. (more readable and achieves the same thing)
Also apply the fix in other files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, fix applied 👍

EemeliJ added 6 commits March 11, 2026 13:05
…s with the path alias (SocialSectionMenu), removed unused lng props from LayoutBackgroundController, Clarified and cleaned up layout related code introduced during the header refactor, removed unnecessary comments, cleaned up the header wrapper from the widgets folder (no header implementation needed here).
@EemeliJ EemeliJ requested a review from Skoivumaki March 11, 2026 13:00
Copy link
Copy Markdown
Member

@Skoivumaki Skoivumaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

Copy link
Copy Markdown
Contributor

@Rutjake Rutjake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! The component looks exactly as it should. However, when you remove components like Button or ExternalLinks, remember to also remove the unused imports. If you’re using VS Code, the ESLint extension is really helpful for catching these.


return (
<div className={cls.MainPage}>
<WallIntroAnimation renderOnce={true} />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing WallIntroAnimation was not part of the issue, but its position in the code needs to be adjusted to ensure it functions as expected. @EemeliJ It should work if you add it below the Header component?

…pletely, should work now with the new header. Also removed some unused imports.
@EemeliJ EemeliJ requested a review from Rutjake March 18, 2026 10:34
…SessionStorage, also refactored timing logic removing a redundant timeout that set the rendered state too early.
Copy link
Copy Markdown
Contributor

@Rutjake Rutjake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Work!

@Rutjake Rutjake merged commit 3453a19 into dev Mar 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants