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

fix: css alignment of calendar component on the home page #3276

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dishafaujdar
Copy link

@dishafaujdar dishafaujdar commented Oct 7, 2024

Fix #3275

Describe the bug.

  1. We need to fix the alignment of "Join our public meeting" on the home page.
  2. Change the calendar card to the height, the same as that of the slack card for the desktop view.

Alignment :

Screenshot from 2024-10-07 08-31-22

Calendar Card :

image

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced styling for the Calendar component with new classes for better visual presentation.
    • Added responsive styles for various screen sizes to improve layout and typography.
  • Bug Fixes

    • Standardized naming conventions for button container attributes.
  • Chores

    • Removed the next-env.d.ts file, which contained TypeScript reference directives.
    • Removed the styles/globals.css file, streamlining CSS management and imports.
    • Updated .gitignore to include styles/globals.css and modified the entry for deno.lock.

Copy link

coderabbitai bot commented Oct 7, 2024

Walkthrough

The pull request introduces modifications to the Calendar component, enhancing its structure and styling. Key changes include the addition of class names for better styling, a standardized data-testid attribute for a button container, and the complete removal of the next-env.d.ts file, which does not affect the functionality of the code. Additionally, the styles/globals.css file has been removed, which included various CSS rules and imports.

Changes

File Change Summary
components/Calendar.tsx Updated class names for styling; added calendar-container class to the wrapping div; added responsive classes for Heading and GoogleCalendarButton; changed data-testid from Calendar-button to calendar-button.
next-env.d.ts Removed the file entirely, eliminating TypeScript reference directives for Next.js.
styles/globals.css Removed the file entirely, which contained CSS rules and imports for styling various components.
.gitignore Added entry to ignore styles/globals.css and modified entry for deno.lock to indicate it should be ignored.

Assessment against linked issues

Objective Addressed Explanation
Fix alignment of "Join our public meeting" (#3275) The changes do not address the specific alignment issue described.

🐰 In the calendar's embrace,
New styles find their place,
With titles bold and bright,
Our meetings now align just right!
Hopping through the code with glee,
A responsive world for you and me! 🌼


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c49a672 and 0021c7c.

📒 Files selected for processing (1)
  • pages/[lang]/index.tsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
pages/[lang]/index.tsx (1)

111-111: ⚠️ Potential issue

Alignment fix needs refinement

The change from 'float-left' to 'content-center' is a step towards fixing the alignment issue mentioned in the PR objectives. However, there are a few concerns:

  1. As per the past review comments, centering should only occur when there are no meetings present. The current change centers the content unconditionally.
  2. The PR objectives also mention adjusting the height of the calendar card to match the Slack card for desktop view, which this change doesn't address.

Consider the following suggestions:

  1. Implement conditional centering based on the presence of meetings. This could be achieved using dynamic class names or CSS conditions.
  2. Address the height adjustment mentioned in the PR objectives.

Here's a potential approach to implement conditional centering:

<Calendar 
  size={2} 
  className={`${meetings.length === 0 ? 'content-center' : 'float-left'} h-full`} 
/>

This assumes there's a meetings array available. If not, you'll need to implement a way to check for the presence of meetings.

For the height adjustment, consider adding a CSS class that sets a specific height for desktop view:

@media (min-width: 1024px) {
  .calendar-height {
    height: 400px; /* Adjust this value to match the Slack card height */
  }
}

Then apply this class to both the Calendar and Slack components:

<Calendar 
  size={2} 
  className={`${meetings.length === 0 ? 'content-center' : 'float-left'} calendar-height`} 
/>

To ensure these changes work as expected, please run the following script:

This script will help verify if the suggested changes have been implemented correctly.


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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

Copy link

netlify bot commented Oct 7, 2024

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 0021c7c
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/6712268daf057d000860a356
😎 Deploy Preview https://deploy-preview-3276--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Oct 7, 2024

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 46
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-3276--asyncapi-website.netlify.app/

Copy link

@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 (3)
components/Calendar.tsx (2)

39-39: LGTM: Addition of 'calendar-title' class with a minor suggestion

The addition of the 'calendar-title' class to the Heading component is good for specific styling of the calendar title. This change aligns with the PR objective of addressing alignment issues.

Consider using template literals for better readability when combining multiple classes:

-<Heading level={HeadingLevel.h2} typeStyle={HeadingTypeStyle.mdSemibold} className='calendar-title'>
+<Heading level={HeadingLevel.h2} typeStyle={HeadingTypeStyle.mdSemibold} className={`calendar-title ${styles.heading}`}>

This approach allows for easier addition of conditional classes in the future if needed.


Line range hint 1-70: Overall assessment: Changes align with PR objectives and improve component consistency

The modifications made to the Calendar component, including the addition of specific classes for styling and the standardization of the test ID, align well with the PR objectives of addressing alignment issues. These changes improve the overall consistency and maintainability of the component.

To further enhance the component's modularity and reusability, consider extracting the styling classes into a separate CSS module or a styled-component. This would allow for easier management of styles and potential theming in the future.

styles/globals.css (1)

126-140: LGTM! Consider a minor adjustment for better maintainability.

The new media query effectively addresses the alignment issue for smaller screens (300px to 400px), which aligns with the PR objectives. The styles improve responsiveness and maintain consistency in the calendar section.

For better maintainability, consider using CSS variables for the font sizes and spacing values. This would make it easier to adjust these values globally in the future. For example:

:root {
  --calendar-font-size-small: 25px;
  --calendar-padding-small: 30px 35px;
  /* ... other variables ... */
}

@media (min-width: 300px) and (max-width: 400px) {
  .calendar-container {
    padding: var(--calendar-padding-small);
    /* ... other styles ... */
  }
  .calendar-title, .calendar-button {
    font-size: var(--calendar-font-size-small);
  }
}

This approach would make it easier to maintain consistent sizes across different components and media queries.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d070b2e and 894a957.

📒 Files selected for processing (3)
  • components/Calendar.tsx (2 hunks)
  • next-env.d.ts (1 hunks)
  • styles/globals.css (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • next-env.d.ts
🧰 Additional context used
🔇 Additional comments (3)
components/Calendar.tsx (2)

33-38: LGTM: Addition of 'calendar-container' class

The addition of the 'calendar-container' class to the outer div is a good approach for targeted styling. The use of twMerge ensures that there are no class conflicts. This change aligns well with the PR objective of addressing alignment issues.


61-61: LGTM: Standardization of data-testid attribute with a caution

The change from 'Calendar-button' to 'calendar-button' for the data-testid attribute improves consistency in the naming convention. This is a good practice for maintaining a standardized codebase.

However, this change might potentially break existing tests that rely on the old test ID. Please ensure that all related tests are updated accordingly. Run the following script to check for any occurrences of the old test ID in test files:

If any occurrences are found, update them to use the new 'calendar-button' test ID.

✅ Verification successful

LGTM: Standardization of data-testid Attribute Confirmed

The change from 'Calendar-button' to 'calendar-button' for the data-testid attribute enhances consistency within the codebase. No existing tests depend on the old test ID, ensuring that this update does not disrupt any test functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for occurrences of the old test ID in test files

# Test: Search for 'Calendar-button' in test files
rg --type-add 'test:*.{test,spec}.{js,jsx,ts,tsx}' --type test 'Calendar-button'

Length of output: 80

styles/globals.css (1)

126-140: Overall, these changes effectively address the alignment issue.

The new media query for screen sizes between 300px and 400px successfully targets the alignment problem described in the PR objectives. The changes are minimal and focused, which reduces the risk of unintended side effects. The styles are consistent with the existing code structure and follow the established patterns in the file.

To ensure these changes don't negatively impact other parts of the website, please run the following verification script:

This script will help identify any potential conflicts or unintended overrides in other CSS files.

✅ Verification successful

Verification Successful: No Conflicts Found

The newly added media query in styles/globals.css does not conflict with any existing media queries. Additionally, the affected classes (calendar-container, calendar-title, calendar-button) are consistently used in both styles/globals.css and components/Calendar.tsx, ensuring that there are no unintended overrides or style conflicts.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any conflicting media queries or overlapping styles

# Test: Search for other media queries that might conflict with the new one
echo "Checking for potentially conflicting media queries:"
rg --type css "media.*and.*max-width.*400px" --glob '!styles/globals.css'

# Test: Search for other occurrences of the affected classes to ensure no unintended overrides
echo "Checking for other occurrences of the affected classes:"
rg --type css "calendar-(container|title|button)" --glob '!styles/globals.css'

Length of output: 688


Script:

#!/bin/bash
# Description: Retry checking for conflicting media queries or overlapping styles without overly restrictive filters

# Test: Search for media queries that might conflict with the new one, excluding styles/globals.css
echo "Checking for potentially conflicting media queries:"
rg "media.*and.*max-width.*400px" --glob '!.git/**' --glob '!node_modules/**' 

# Test: Search for other occurrences of the affected classes to ensure no unintended overrides
echo "Checking for other occurrences of the affected classes:"
rg "calendar-(container|title|button)" --glob '!.git/**' --glob '!node_modules/**'

Length of output: 923

@dishafaujdar dishafaujdar changed the title Css alignment fix: css alignment Oct 7, 2024
@aeworxet
Copy link
Contributor

aeworxet commented Oct 7, 2024

How about doing only

- <Calendar size={2} className='float-left' />
+ <Calendar size={2} className='content-center' />

in ./pages/[lang]/index.tsx that will achieve the same thing?

image

Copy link

@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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2c6d7e8 and 41cf0a6.

📒 Files selected for processing (1)
  • .gitignore (1 hunks)
🧰 Additional context used

.gitignore Outdated
@@ -22,3 +22,4 @@ cypress/videos
/storybook-static/
coverage
deno.lock
/styles/globals.css
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Inconsistency Detected with styles/globals.css Tracking

The addition of /styles/globals.css to .gitignore is inconsistent because:

  1. styles/globals.css exists and is tracked by Git.
  2. It is referenced in pages/_app.tsx.

This implies that ignoring it in .gitignore has no effect and may lead to confusion or unintended behavior. Please review the necessity of this .gitignore entry.

🔗 Analysis chain

Verify the intention of ignoring styles/globals.css

The addition of /styles/globals.css to .gitignore is a valid change. However, please confirm if this is intentional and consider the following implications:

  1. Changes to globals.css will no longer be tracked by Git, which could lead to inconsistencies across different environments.
  2. Other developers might lose access to important global styles.

Also, there seems to be an inconsistency:

  • The PR objectives mention modifications to globals.css.
  • The AI summary states that styles/globals.css has been removed.
  • Yet, we're adding it to .gitignore, which implies the file still exists but should be ignored.

Could you clarify the status and intention for styles/globals.css?

To help verify the status of styles/globals.css, please run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the status of styles/globals.css

# Test 1: Check if the file exists
if [ -f "styles/globals.css" ]; then
    echo "styles/globals.css exists"
else
    echo "styles/globals.css does not exist"
fi

# Test 2: Check Git status of the file
git status --porcelain styles/globals.css

# Test 3: Check if the file is tracked by Git
git ls-files --error-unmatch styles/globals.css 2>/dev/null
if [ $? -eq 0 ]; then
    echo "styles/globals.css is tracked by Git"
else
    echo "styles/globals.css is not tracked by Git"
fi

# Test 4: Check for references to globals.css in other files
echo "Files referencing globals.css:"
rg "globals\.css" --type css --type html --type javascript --type typescript

Length of output: 491


Script:

#!/bin/bash
# Description: Re-verify the status of styles/globals.css with corrected file type identifiers

# Test 1: Check if the file exists
if [ -f "styles/globals.css" ]; then
    echo "styles/globals.css exists"
else
    echo "styles/globals.css does not exist"
fi

# Test 2: Check Git status of the file
git status --porcelain styles/globals.css

# Test 3: Check if the file is tracked by Git
git ls-files --error-unmatch styles/globals.css 2>/dev/null
if [ $? -eq 0 ]; then
    echo "styles/globals.css is tracked by Git"
else
    echo "styles/globals.css is not tracked by Git"
fi

# Test 4: Check for references to globals.css in other files
echo "Files referencing globals.css:"
rg "globals\.css" --type css --type html --type js --type ts

Length of output: 487

@devilkiller-ag
Copy link
Member

@dishafaujdar Use more descriptive title for the PR. Something like 'Fix CSS alignment of calendar component on the home page' will work great.

@dishafaujdar dishafaujdar changed the title fix: css alignment fix: css alignment of calendar component on the home page Oct 8, 2024
@dishafaujdar
Copy link
Author

@devilkiller-ag I'll keep that in mind.

Copy link
Member

@devilkiller-ag devilkiller-ag 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 to me!

<div className={twMerge('overflow-hidden rounded-md border border-gray-200 bg-white p-4', className)}>
<Heading level={HeadingLevel.h2} typeStyle={HeadingTypeStyle.mdSemibold}>
<div
className={twMerge(
Copy link
Member

Choose a reason for hiding this comment

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

In the mobile/tab view, the calendar div is not in the center, rather it is slightly shifted towards the right.
Screenshot from 2024-10-07 12-15-03

It should be in the center like other cards:
Screenshot from 2024-10-07 12-15-16

@aeworxet
Copy link
Contributor

aeworxet commented Oct 8, 2024

Can workflows be approved and an approving comment posted once again after they run, please?

@devilkiller-ag devilkiller-ag mentioned this pull request Oct 12, 2024
@@ -108,7 +108,7 @@ export default function HomePage() {

<div className='mt-12 lg:flex lg:flex-row-reverse'>
<section className='mt-10 lg:mt-0 lg:flex-1'>
<Calendar size={2} className='float-left' />
<Calendar size={2} className='content-center' />
Copy link
Member

Choose a reason for hiding this comment

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

In this way, all the content inside component will be centred, but we only want the content to be centred, when there are no meetings present.

Copy link
Author

Choose a reason for hiding this comment

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

@akshatnema I am working on the change that you've suggested.
image

@aeworxet
Copy link
Contributor

@dishafaujdar
I have sent the instruction on fixing the PR to your Slack.

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.

[BUG] wrong alignment of join our public meeting
5 participants