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): Add logoImageClassName to default header #16582

Merged

Conversation

mannipje
Copy link
Member

@mannipje mannipje commented Oct 28, 2024

Add logoImageClassName to default header

What

  • Add optional boolean logoImageClassName prop to default organization header.

Why

This was requested by Digital Iceland to make Faggilding organization logo larger.

Screenshots / Gifs

Before

image

After

image

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 a customizable logo styling option in the header component.
    • Added support for a new 'faggilding' theme in the organization header.
  • Styling Enhancements

    • New logo size styling defined for improved presentation in the organization wrapper.

@mannipje mannipje added the automerge Merge this PR as soon as all checks pass label Oct 28, 2024
@mannipje mannipje requested review from a team as code owners October 28, 2024 10:06
Copy link
Contributor

coderabbitai bot commented Oct 28, 2024

Walkthrough

The changes in this pull request introduce a new optional property logoImageClassName to the DefaultHeaderProps interface, enhancing the customization of the logo's styling in the DefaultHeader component. Additionally, a new case for the 'faggilding' theme is added to the OrganizationHeader component, which utilizes the new property. A corresponding style for logoLarge is also defined in the CSS module. These modifications collectively improve the flexibility and styling options for headers based on organization themes.

Changes

File Path Change Summary
apps/web/components/DefaultHeader/DefaultHeader.tsx Added optional property logoImageClassName to DefaultHeaderProps and updated the component to use it.
apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx Introduced a new case for 'faggilding' theme in OrganizationHeader, rendering DefaultHeader with logoImageClassName.
apps/web/components/Organization/Wrapper/OrganizationWrapper.css.ts Added new style constant logoLarge with dimensions 80px for logo customization.

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: 4

🧹 Outside diff range and nitpick comments (1)
apps/web/components/DefaultHeader/DefaultHeader.tsx (1)

35-35: Consider renaming the prop for better clarity.

The prop name logoImageClassName suggests it accepts a string class name, but it's actually a boolean toggle. Consider renaming to something more descriptive like isLogoLarge or useLargeLogo to better reflect its purpose.

-  logoImageClassName?: boolean
+  isLogoLarge?: boolean
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f799ad2 and e4dc197.

📒 Files selected for processing (3)
  • apps/web/components/DefaultHeader/DefaultHeader.css.ts (1 hunks)
  • apps/web/components/DefaultHeader/DefaultHeader.tsx (4 hunks)
  • apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
apps/web/components/DefaultHeader/DefaultHeader.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/DefaultHeader/DefaultHeader.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."
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 (4)
apps/web/components/DefaultHeader/DefaultHeader.css.ts (1)

134-137: Implementation follows established patterns.

The new logoLarge style is correctly implemented using vanilla-extract and maintains consistency with existing logo styles.

apps/web/components/DefaultHeader/DefaultHeader.tsx (2)

59-59: LGTM!

The prop is correctly destructured and follows the component's parameter ordering convention.


93-99: LGTM! Good accessibility implementation.

The logo implementation is well-structured with proper conditional class application and includes alt text for accessibility.

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

616-622: LGTM! The faggilding case implementation looks good.

The implementation:

  • Correctly uses the DefaultHeader component
  • Properly passes the logoImageClassName prop using the namespace function
  • Follows the existing pattern of other organization cases
  • Aligns with the PR objective to support larger logos for Faggilding organization

apps/web/components/DefaultHeader/DefaultHeader.css.ts Outdated Show resolved Hide resolved
apps/web/components/DefaultHeader/DefaultHeader.tsx Outdated Show resolved Hide resolved
apps/web/components/DefaultHeader/DefaultHeader.tsx Outdated Show resolved Hide resolved
Copy link

codecov bot commented Oct 28, 2024

Codecov Report

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

Project coverage is 36.78%. Comparing base (237e3f0) to head (ecf12da).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...pps/web/components/DefaultHeader/DefaultHeader.tsx 0.00% 5 Missing ⚠️
...nents/Organization/Wrapper/OrganizationWrapper.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main   #16582    +/-   ##
========================================
  Coverage   36.78%   36.78%            
========================================
  Files        6858     6855     -3     
  Lines      142402   142297   -105     
  Branches    40613    40592    -21     
========================================
- Hits        52378    52346    -32     
+ Misses      90024    89951    -73     
Flag Coverage Δ
web 1.79% <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%> (ø)
...pps/web/components/DefaultHeader/DefaultHeader.tsx 0.00% <0.00%> (ø)

... and 20 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 237e3f0...ecf12da. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 28, 2024

Datadog Report

Branch report: feature/organization-default-header-add-logo-image-classname
Commit report: 5626b74
Test service: web

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

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: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between e4dc197 and 1e4475c.

📒 Files selected for processing (3)
  • apps/web/components/DefaultHeader/DefaultHeader.tsx (4 hunks)
  • apps/web/components/Organization/Wrapper/OrganizationWrapper.css.ts (1 hunks)
  • apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/components/DefaultHeader/DefaultHeader.tsx
🧰 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 (1)
apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx (1)

616-622: Verify DefaultHeader component integration.

Let's ensure the DefaultHeader component properly supports the new logoImageClassName prop.

✅ Verification successful

DefaultHeader integration is properly configured

The verification shows that:

  1. The DefaultHeader component properly accepts the logoImageClassName prop in its interface definition
  2. The corresponding CSS style logoLarge exists in OrganizationWrapper.css.ts with appropriate width and height settings
  3. The style is correctly passed to the component
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify DefaultHeader component supports logoImageClassName prop
# and corresponding CSS styles exist

# Test 1: Check if DefaultHeader component accepts logoImageClassName prop
ast-grep --pattern 'interface DefaultHeaderProps {
  $$$
  logoImageClassName?: $_
  $$$
}'

# Test 2: Check for corresponding CSS styles
rg -A 2 'logoLarge|logo.*large' '*.css.ts'

Length of output: 1980


Script:

#!/bin/bash
# Let's check the CSS styles with the correct file extension and path pattern
rg -A 2 'logoLarge|logo.*large' --type css

# Also verify how the logoImageClassName is used in DefaultHeader
ast-grep --pattern 'const DefaultHeader = ($$$) => {
  $$$
  logoImageClassName
  $$$
}'

# Check other usages of DefaultHeader with logoImageClassName
rg "DefaultHeader.*logoImageClassName" -A 2

Length of output: 181


Script:

#!/bin/bash
# Let's check the actual implementation of DefaultHeader to see how logoImageClassName is used
ast-grep --pattern 'export const DefaultHeader = ({ $$$, logoImageClassName, $$$ }: DefaultHeaderProps) => {
  $$$
}'

# Check the styles file in the Organization/Wrapper directory
rg -l "logoLarge" apps/web/components/Organization/Wrapper/

# Check for any CSS module files in the Organization/Wrapper directory
fd ".*\.module\.(css|scss)" apps/web/components/Organization/Wrapper/

Length of output: 384


Script:

#!/bin/bash
# Let's check the content of the CSS file to verify the logoLarge style
cat apps/web/components/Organization/Wrapper/OrganizationWrapper.css.ts

# Let's also check how DefaultHeader is used with logoImageClassName in the wrapper
rg -A 5 "DefaultHeader.*logoImageClassName" apps/web/components/Organization/Wrapper/OrganizationWrapper.tsx

Length of output: 7228

@kodiakhq kodiakhq bot merged commit 3a35311 into main Oct 29, 2024
30 checks passed
@kodiakhq kodiakhq bot deleted the feature/organization-default-header-add-logo-image-classname branch October 29, 2024 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants