Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): Change default header styles for organizations #16218

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

mannipje
Copy link
Member

@mannipje mannipje commented Sep 30, 2024

Change default header styles for organizations

What

CSS was wrong, it shouldn't be setting the header height to 315 px on subpages

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced new styles for subpage layouts in various header grid containers, enhancing visual consistency.
    • Conditional rendering logic added for headers based on organization themes, improving style adaptability for subpages.
  • Bug Fixes

    • Adjusted class names for headers to ensure correct styling based on the page type (subpage or main page).

@mannipje mannipje added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 30, 2024
@mannipje mannipje requested a review from a team as a code owner September 30, 2024 15:24
Copy link
Contributor

coderabbitai bot commented Sep 30, 2024

Walkthrough

The changes involve the addition of new CSS styles for various organization subpage layouts and modifications to the rendering logic in the OrganizationWrapper component. New styles have been created for specific header grid containers, ensuring a consistent layout structure for subpages. Additionally, the rendering logic has been refined to conditionally apply styles based on the organization theme and whether the page is a subpage.

Changes

File Change Summary
apps/web/components/Organization/Wrapper/OrganizationWrapper.css.ts Added new styles for subpage layouts, including sakHeaderGridContainerSubpage, landlaeknirHeaderGridContainerSubpage, shhHeaderGridContainerWidthSubpage, rikissaksoknariHeaderGridContainerSubpage, hsaHeaderGridContainerWidthSubpage, and hveHeaderGridContainerSubpage.
apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx Modified rendering logic for headers and footers based on organization themes, with conditional class names for subpages.

Possibly related PRs

Suggested labels

high priority

Suggested reviewers

  • RunarVestmann

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (4)
apps/web/components/Organization/Wrapper/OrganizationWrapper.css.ts (3)

37-47: LGTM with a minor suggestion.

The new sakHeaderGridContainerSubpage style is well-structured and consistent with the existing patterns. It appropriately uses responsive styling and allows for flexible content height on subpages.

Consider using a shared constant for the maxWidth value (1342px) to improve maintainability, as this value is repeated across multiple styles in the file.


96-106: LGTM. Consider refactoring to reduce duplication.

The shhHeaderGridContainerWidthSubpage style is consistent with the previous subpage styles, maintaining the same structure and best practices.

To reduce code duplication, consider creating a base subpage style that can be extended or composed for each specific organization. This would improve maintainability and reduce the likelihood of inconsistencies. For example:

const baseSubpageStyle = style({
  display: 'grid',
  maxWidth: '1342px',
  margin: '0 auto',
  ...themeUtils.responsiveStyle({
    lg: {
      gridTemplateRows: 'auto',
      gridTemplateColumns: '100fr',
    },
  }),
})

export const shhHeaderGridContainerWidthSubpage = style([
  baseSubpageStyle,
  // Add any SHH-specific styles here
])

Line range hint 1-254: Overall assessment: Changes look good with room for improvement.

The new subpage styles effectively address the PR objective of correcting header height issues on subpages. The implementation is consistent across all new styles and follows NextJS and TypeScript best practices.

Key points:

  1. All new styles maintain a consistent structure, improving maintainability.
  2. Organization-specific styling is handled appropriately where needed.
  3. The use of themeUtils.responsiveStyle ensures proper responsive behavior.

To further improve the code:

  1. Consider creating a base subpage style to reduce duplication across the various organization-specific styles.
  2. Use a shared constant for common values like maxWidth: '1342px' to improve maintainability.

These refactoring suggestions will enhance code maintainability and reduce the likelihood of inconsistencies in future updates.

apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx (1)

459-463: LGTM: Consistent styling approach, consider refactoring

The addition of a conditional className based on the isSubpage prop for the hve case is consistent with the previous cases and aligns with the PR's objective.

Consider refactoring this repeated pattern across multiple organization cases to reduce code duplication. You could create a helper function that generates the appropriate className based on the theme and isSubpage prop. For example:

const getHeaderClassName = (theme: string, isSubpage: boolean) => {
  const themeMap = {
    landlaeknir: [styles.landlaeknirHeaderGridContainer, styles.landlaeknirHeaderGridContainerSubpage],
    sak: [styles.sakHeaderGridContainer, styles.sakHeaderGridContainerSubpage],
    hve: [styles.hveHeaderGridContainer, styles.hveHeaderGridContainerSubpage],
    // Add other themes here
  };

  return isSubpage ? themeMap[theme][1] : themeMap[theme][0];
};

// Usage
className={getHeaderClassName('hve', isSubpage)}

This refactoring would make the code more maintainable and easier to extend for future theme additions.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 50e0899 and 01985b7.

📒 Files selected for processing (2)
  • apps/web/components/Organization/Wrapper/OrganizationWrapper.css.ts (6 hunks)
  • apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
apps/web/components/Organization/Wrapper/OrganizationWrapper.css.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (7)
apps/web/components/Organization/Wrapper/OrganizationWrapper.css.ts (4)

61-71: LGTM. Consistent with previous styles.

The landlaeknirHeaderGridContainerSubpage style is consistent with the sakHeaderGridContainerSubpage style, following the same structure and best practices.


139-155: LGTM. Organization-specific styling handled well.

The rikissaksoknariHeaderGridContainerSubpage style maintains consistency with other subpage styles while incorporating organization-specific background styling. The use of template literals for complex background values is appropriate and improves readability.

If you decide to implement the base subpage style as suggested earlier, ensure that this organization-specific background styling is preserved when extending the base style.


169-179: LGTM. Consistent with other subpage styles.

The hsaHeaderGridContainerWidthSubpage style maintains consistency with the previously reviewed subpage styles, following the same structure and best practices.

This style further emphasizes the potential benefit of creating a base subpage style to reduce duplication, as suggested earlier. Consider implementing this refactoring to improve code maintainability.


243-254: LGTM. Organization-specific border styling handled appropriately.

The hveHeaderGridContainerSubpage style maintains consistency with other subpage styles while incorporating an organization-specific border styling. This approach allows for customization while keeping the overall structure consistent.

When implementing the suggested base subpage style, ensure that this organization-specific border styling is preserved. You might consider using a composition approach to combine the base style with organization-specific styles:

export const hveHeaderGridContainerSubpage = style([
  baseSubpageStyle,
  {
    borderBottom: '8px solid #F01E28',
  }
])

This approach would maintain consistency while allowing for organization-specific customizations.

apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx (3)

358-362: LGTM: Conditional styling for subpages

The addition of conditional className based on the isSubpage prop is a good approach to apply different styles for subpages and main pages. This change aligns well with the PR objective of correcting header height issues on subpages.


423-427: LGTM: Consistent subpage styling approach

The addition of a conditional className based on the isSubpage prop for the sak case is consistent with the previous landlaeknir case. This change maintains a uniform approach to applying different styles for subpages and main pages across different organization themes.


Line range hint 1-1391: Summary: Consistent implementation of subpage styling across themes

The changes in this file focus on applying different styles for subpages across various organization themes (landlaeknir, sak, hve). The implementation is consistent and aligns well with the PR objective of correcting header height issues on subpages.

While the changes are correct and achieve the desired outcome, there's an opportunity to refactor the repeated pattern to reduce code duplication and improve maintainability. Consider implementing a helper function as suggested in the previous comment.

Overall, these changes provide better control over header styling for different page types without introducing new functionality.

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 36.69%. Comparing base (306033d) to head (85d7b0a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...nents/Organization/Wrapper/OrganizationWrapper.tsx 0.00% 6 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16218      +/-   ##
==========================================
- Coverage   36.70%   36.69%   -0.01%     
==========================================
  Files        6781     6779       -2     
  Lines      139720   139691      -29     
  Branches    39725    39731       +6     
==========================================
- Hits        51284    51265      -19     
+ Misses      88436    88426      -10     
Flag Coverage Δ
web 1.83% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...nents/Organization/Wrapper/OrganizationWrapper.tsx 0.00% <0.00%> (ø)

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 306033d...85d7b0a. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Sep 30, 2024

Datadog Report

Branch report: feature/change-default-header-styles-for-organizations
Commit report: 3b4fe5d
Test service: web

✅ 0 Failed, 84 Passed, 0 Skipped, 31.18s Total Time
➡️ Test Sessions change in coverage: 1 no change

@kodiakhq kodiakhq bot merged commit 2e17b5d into main Sep 30, 2024
30 checks passed
@kodiakhq kodiakhq bot deleted the feature/change-default-header-styles-for-organizations branch September 30, 2024 21:14
thoreyjona pushed a commit that referenced this pull request Oct 2, 2024
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants