-
-
Notifications
You must be signed in to change notification settings - Fork 45
Select #40
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
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis pull request replaces an existing Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant ST as SelectTrigger
participant SC as SelectContent
participant SI as SelectItem
U->>ST: Click trigger to open dropdown
ST->>SC: Render dropdown with options
U->>SC: Browse available options
U->>SI: Click to select an option
SI->>ST: Update displayed value
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Nitpick comments (4)
preview/components/select-style-default.tsx (1)
1-20: Good implementation of the Select component demo!This component effectively demonstrates how to use the new Select component with a clear example using Pokémon options. The structure follows the Radix UI pattern which will be familiar to users of that library.
For a more complete example, consider:
- Adding state management to track the selected value
- Including an onValueChange handler to demonstrate handling selection changes
- Adding a code comment explaining the component's purpose as a demo
import { Select } from "@/packages/ui"; import React from "react"; +import { useState } from "react"; export default function SelectStyleDefault() { + const [value, setValue] = useState(""); + return ( <Select> - <Select.Trigger className="w-60"> + <Select.Trigger className="w-60" onValueChange={setValue}> <Select.Value placeholder="Pick your favorite Pokemon" /> </Select.Trigger> <Select.Content> <Select.Group> <Select.Item value="pikachu">Pikachu</Select.Item> <Select.Item value="charizard">Charizard</Select.Item> <Select.Item value="bulbasaur">Bulbasaur</Select.Item> <Select.Item value="squirtle">Squirtle</Select.Item> </Select.Group> </Select.Content> </Select> ); }components/SideNav.tsx (1)
8-8: Consider using fixed height with overflow-y-auto instead of overflow-y-scroll.The
overflow-y-scrollproperty always shows the scrollbar even when content doesn't overflow, which might not be ideal for UI aesthetics. Usingoverflow-y-autowould only show scrollbars when needed.- className={`fixed right-auto border-r-2 border-black h-full overflow-y-scroll transition-transform transform md:translate-x-0 w-64 bg-white flex flex-col justify-center md:justify-start py-14 md:py-8`} + className={`fixed right-auto border-r-2 border-black h-full overflow-y-auto transition-transform transform md:translate-x-0 w-64 bg-white flex flex-col justify-center md:justify-start py-14 md:py-8`}packages/ui/Form/Select.tsx (2)
10-29: Consider adding disabled and error states to the trigger component.The trigger component lacks specific styling for error states and could be enhanced with clearer disabled styling.
className={cn( "flex h-10 min-w-40 items-center shadow-md justify-between border-2 border-input border-black bg-transparent px-4 py-2 ring-offset-background placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50", + props.disabled && "bg-gray-100 opacity-70", + props['aria-invalid'] && "border-red-500", className )}
68-88: Consider keyboard focus styling for select items.The select items have hover styling but could benefit from explicit focus styling for better keyboard navigation visibility.
className={cn( "relative flex w-full cursor-default select-none items-center py-1.5 px-2 outline-none hover:bg-primary-400 data-[disabled]:pointer-events-none data-[disabled]:opacity-50", + "focus:bg-primary-300 focus:outline-none", className )}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
app/(sink)/demo/components/page.tsx(2 hunks)app/global.css(1 hunks)components/SideNav.tsx(1 hunks)config/components.ts(2 hunks)config/navigation.ts(2 hunks)content/docs/components/select.mdx(1 hunks)content/docs/index.mdx(2 hunks)package.json(1 hunks)packages/ui/Form/Select.tsx(1 hunks)packages/ui/Form/index.tsx(1 hunks)packages/ui/Menu/Menu.tsx(1 hunks)preview/components/select-style-default.tsx(1 hunks)tailwind.config.ts(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- content/docs/components/select.mdx
🔇 Additional comments (24)
packages/ui/Form/index.tsx (1)
5-5: Import of new Select component properly added.This export statement correctly adds the new Select component, following the same pattern as the other form component exports.
package.json (1)
19-19: New Radix UI Select dependency added correctly.The addition of
@radix-ui/react-selectis consistent with the project's existing pattern of using Radix UI primitives for components. The version specified (^2.1.6) follows proper semantic versioning.packages/ui/Menu/Menu.tsx (1)
34-34: Hover text color styling removed from MenuItem.The
hover:text-whiteclass has been removed from the MenuItem component. This styling change means the text color will no longer change on hover while the background color will still change toprimary-400. This is likely to maintain consistency with the new Select component styling.app/(sink)/demo/components/page.tsx (2)
11-11: Select component properly imported.The Select component is correctly added to the imports from the UI package.
47-58: RadioGroup successfully replaced with new Select component.The implementation of the Select component follows the compound component pattern used throughout the project. The structure with Trigger, Value, Content, Group, and Item components is consistent with other UI components and provides a good example of the component's usage.
config/navigation.ts (3)
15-15: Navigation updated to reflect documentation changes.The Introduction page is now correctly tagged as "Updated".
26-30: Tags appropriately removed from existing components.Good cleanup - removing the "New" tags from Checkbox and Radio components as they're no longer new additions.
31-31: New Select component properly added to navigation.The Select component is correctly added to the navigation with the "New" tag.
tailwind.config.ts (3)
22-22: New box shadow size added.The new
smbox shadow size fits well between the existingxsandmdsizes, providing more granular options.
26-28: Theme variables added for background and foreground colors.Good addition of CSS variables for background and foreground colors. This enables better theming support.
29-39: Primary color palette updated to use CSS variables.Excellent refactoring to use CSS variables for the primary color palette instead of hardcoded hex values. This approach:
- Improves theming capabilities
- Allows for easier dark mode implementation
- Centralizes color management in CSS
Note that this change requires the CSS variables defined in global.css to function properly.
app/global.css (2)
7-8: Base theme variables added.Adding background and foreground variables provides a good foundation for theming support.
9-18: Complete primary color palette defined.Well-structured primary color palette with a consistent naming convention and a proper gradient from light to dark shades. The color scheme appears to follow a yellow-to-orange gradient, which matches well with the project's theme.
Consider documenting the color system in your design documentation to help other developers understand the palette.
config/components.ts (2)
60-63: LGTM! Good addition of the Select component.The Select component has been properly registered in the core components section.
219-223: LGTM! Good addition of the Select style example.The Select style example has been properly registered in the examples section.
content/docs/index.mdx (5)
35-55: Good enhancement of theming documentation with CSS variables.Using CSS variables for theming is a good practice as it improves maintainability and allows for easier theme switching. The documentation clearly explains how to implement this approach.
64-71: Good addition of content paths for Tailwind CSS.The explicit content paths ensure Tailwind CSS properly processes all the relevant files in the project.
74-76: Good addition of muted text color variable.Adding a muted text color variable improves consistency in the UI.
87-99: Good refactoring to use CSS variables for colors.Replacing hardcoded color values with CSS variables improves maintainability and makes theme customization easier.
104-104: Good addition of the animate plugin.Adding the tailwindcss-animate plugin will enable animation utilities that can enhance the user experience.
packages/ui/Form/Select.tsx (4)
1-7: LGTM! Good setup with client-side directive and necessary imports.The component correctly uses the "use client" directive since it uses interactive React hooks from Radix UI. The imports are well organized.
8-8: LGTM! Good use of Radix UI primitives.Using Radix UI provides strong accessibility features out-of-the-box.
35-64: LGTM! Well-implemented positioning and animations for select content.The content component handles different positioning options well and includes smooth animations for opening/closing states.
92-103: LGTM! Good component composition with Object.assign.Using Object.assign to create a compound component is a clean pattern that makes the component more intuitive to use.
components/SideNav.tsx
Outdated
| className={`fixed right-auto border-r-2 border-black h-full overflow-y-scroll transition-transform transform md:translate-x-0 w-64 bg-white flex flex-col justify-center md:justify-start py-14 md:py-8`} | ||
| > | ||
| <nav className="flex flex-col items-start pr-6 space-y-4"> | ||
| <nav className="flex flex-col items-start pr-6 h-full pb-24 overflow-scroll space-y-4"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid nested scrollable containers.
Having overflow-scroll on both the parent div and this nav element creates nested scrollable containers, which can cause usability issues where users get stuck in one scroll container. Consider removing the overflow property from this element since the parent already handles scrolling.
- <nav className="flex flex-col items-start pr-6 h-full pb-24 overflow-scroll space-y-4">
+ <nav className="flex flex-col items-start pr-6 h-full pb-24 space-y-4">📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <nav className="flex flex-col items-start pr-6 h-full pb-24 overflow-scroll space-y-4"> | |
| <nav className="flex flex-col items-start pr-6 h-full pb-24 space-y-4"> |
Summary by CodeRabbit
New Features
Documentation
Style
Chores