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

Set the primary background color on the weekday when selected #10014

Conversation

NikhilA8606
Copy link
Contributor

@NikhilA8606 NikhilA8606 commented Jan 16, 2025

UI changed

Initially : There is only a narrow border is showing while selecting a day in weekday in create new session
Changes : Set a fix primary bg colour on the selection of week day

image

  • More?

@ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

Summary by CodeRabbit

  • Style Updates
    • Updated button variant styling in WeekdayCheckbox component
    • Refined input field border color for enhanced visibility
    • Modified textarea border color for improved visual consistency

@NikhilA8606 NikhilA8606 requested a review from a team as a code owner January 16, 2025 12:24
Copy link
Contributor

coderabbitai bot commented Jan 16, 2025

Walkthrough

The pull request modifies several UI components, specifically changing the visual styles of buttons and input elements. In the WeekdayCheckbox component, the button variant for selected days is updated from "outline_primary" to "primary". The Input component sees a change in its class names to adjust the border color, while the Textarea component's border color class is altered to a darker shade. Overall, these changes focus on enhancing the visual representation of the components.

Changes

File Change Summary
src/CAREUI/interactive/WeekdayCheckbox.tsx Modified button variant from "outline_primary" to "primary" for selected days.
src/components/ui/input.tsx Updated class string for <input> element, changing border color from border-gray-200 to border-gray-400/75.
src/components/ui/textarea.tsx Changed border color class from border-gray-200 to border-gray-400/75 for <textarea> element.

Possibly related PRs

Suggested labels

tested

Suggested reviewers

  • rithviknishad
  • Jacobjeevan

Poem

🐰 A button's hue, a subtle shift,
From outline's edge to primary's lift,
A checkbox dance of style so neat,
Where weekdays click and colors meet!
Hop, hop, design takes flight! 🎨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b4d2d7 and 2472e60.

📒 Files selected for processing (1)
  • src/components/ui/input.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/ui/input.tsx

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

netlify bot commented Jan 16, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 2472e60
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/6789f72359b6240008766b97
😎 Deploy Preview https://deploy-preview-10014--care-ohc.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.

@NikhilA8606 NikhilA8606 changed the title weekdays-primary-bg-on-selection Set the primary background color on the weekday when selected Jan 16, 2025
Copy link
Member

@rithviknishad rithviknishad left a comment

Choose a reason for hiding this comment

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

can we make the borders of other inputs (such as Session name, time inputs, etc.) also consistent with ones in the session type select?

cc: @vinutv

image

@NikhilA8606
Copy link
Contributor Author

NikhilA8606 commented Jan 16, 2025

@rithviknishad Did you mean the border should remain consistent after selection, or should a background be applied to all of them after selection?

@github-actions github-actions bot added needs-triage question Further information is requested labels Jan 16, 2025
@rithviknishad
Copy link
Member

no, observe the difference between the border of "Session Type" drop-down and "Session Title" / "Start Time" / "End Time". The shade is different right? Let's make it consistent.

@rithviknishad rithviknishad removed question Further information is requested needs-triage labels Jan 16, 2025
@github-actions github-actions bot added needs-triage question Further information is requested labels Jan 16, 2025
@NikhilA8606
Copy link
Contributor Author

@rithviknishad Is it correct?

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

🧹 Nitpick comments (1)
src/components/ui/input.tsx (1)

Line range hint 5-22: Consider adding size variants for better reusability.

Since this is a reusable input component, consider enhancing it with:

  1. Size variants (sm, md, lg) to avoid hard-coded heights
  2. Configurable border and focus colors through props

Example implementation:

type InputSize = 'sm' | 'md' | 'lg';
type InputProps = React.ComponentProps<"input"> & {
  size?: InputSize;
  borderColor?: string;
  focusColor?: string;
};

const sizeClasses: Record<InputSize, string> = {
  sm: 'h-8',
  md: 'h-9',
  lg: 'h-10'
};

const Input = React.forwardRef<HTMLInputElement, InputProps>(
  ({ className, type, size = 'md', borderColor, focusColor, ...props }, ref) => {
    return (
      <input
        type={type}
        className={cn(
          "flex w-full items-center justify-between whitespace-nowrap rounded-md border bg-white px-3 py-2 text-sm shadow-sm transition-colors",
          sizeClasses[size],
          borderColor || "border-gray-400/75",
          focusColor ? `focus:border-${focusColor}` : "focus:border-primary-500",
          // ... rest of the classes
          className,
        )}
        ref={ref}
        {...props}
      />
    );
  }
);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3cb1f7 and 3b4d2d7.

📒 Files selected for processing (2)
  • src/components/ui/input.tsx (1 hunks)
  • src/components/ui/textarea.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/components/ui/textarea.tsx
🔇 Additional comments (1)
src/components/ui/input.tsx (1)

11-11: LGTM! The styling changes align with the PR objectives.

The updated styling improves visual consistency by:

  • Using a darker border color (gray-400/75) to match other form elements
  • Adding clear focus states with primary colors
  • Maintaining dark mode support

Please verify:

  1. The border opacity (75%) provides sufficient contrast for accessibility
  2. The fixed height (h-9) maintains layout consistency across all usage contexts
  3. The focus ring color (primary-900) is visible enough against all backgrounds

Run this script to check for potential layout issues with the new fixed height:

✅ Verification successful

The fixed height (h-9) implementation is safe and consistent.

Our codebase analysis shows no conflicting height customizations or wrapper components that would be affected by the standardized height. You can proceed with confidence regarding the layout consistency.

Please still verify:

  1. The border opacity (75%) provides sufficient contrast for accessibility
  2. The focus ring color (primary-900) is visible enough against all backgrounds
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for existing height classes on Input components that might conflict
rg -A 2 '<Input.*className=' | grep -E 'h-[0-9]+'

# Search for custom height styles that might be affected
rg 'input.*height:' --type css

Length of output: 267


Script:

#!/bin/bash
# Search for Input components with inline style attributes
rg -B1 -A2 '<Input.*style='

# Search for components wrapping Input with style/className that might affect height
ast-grep --pattern 'const $_ = $$$<Input$$$' -f tsx

Length of output: 261


Script:

#!/bin/bash
# Search for Input components with inline style attributes
rg -B1 -A2 '<Input.*style='

# Search for styled Input components
rg "styled\(Input\)" 

# Look for form components that might wrap Input
rg -B2 -A2 '<(Form|FormField).*>.*\s*<Input'

# Search for Input wrapper components with correct ast-grep syntax
ast-grep --pattern 'const $_ = () => {
  $$$
  return (
    $$$
    <Input
    $$$
  )
}'

Length of output: 191

@rithviknishad rithviknishad merged commit 24fe107 into ohcnetwork:develop Jan 17, 2025
19 checks passed
@rithviknishad rithviknishad removed question Further information is requested changes required needs-triage labels Jan 17, 2025
Copy link

@NikhilA8606 Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants