Skip to content

feat: Container component #3257

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

feat: Container component #3257

wants to merge 5 commits into from

Conversation

MichaelUnkey
Copy link
Collaborator

@MichaelUnkey MichaelUnkey commented May 13, 2025

What does this PR do?

Fixes # (issue)

If there is not an issue for this, please create one first. This is used to tracking purposes and also helps use understand why this PR exists

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

  • Test A

    • Locations for ControlsContainer still have same styles and functions as main
      Locations In Dashboard
      • /apis/[apiId]/_overview/components/controls/index.tsx
      • /apis/_components/controls/index.tsx
      • /audit/components/controls/index.tsx
      • /logs/components/controls/index.tsx
      • /ratelimits/[namespaceId]/_overview/components/controls/index.tsx
      • /ratelimits/[namespaceId]/logs/components/controls/index.tsx
      • /ratelimits/_components/controls/index.tsx
  • Test B

    • Locations for FlexibleContainer still have same styles and functions as main
      Locations In Dashboard:
      -/apis/[apiId]/api-id-navbar.tsx
      -/apis/[apiId]/page.tsx
      -/apis/[apiId]/_overview/logs-client.tsx
      -/apis/_components/api-list-client.tsx
  • Test C Eng docs are sufficient.

Note: More options will be added to this component when the need arises.

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • Ran pnpm fmt
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Unkey Docs if changes were necessary

Summary by CodeRabbit

  • New Features

    • Introduced a new flexible layout container, offering configurable padding and alignment options for consistent and responsive layouts.
    • Added new control container components for grouping and aligning controls within the interface.
  • Refactor

    • Updated various dashboard components to use new flexible and control container components, improving layout consistency and maintainability.
  • Documentation

    • Added comprehensive documentation and usage examples for the new flexible container component.

Copy link

changeset-bot bot commented May 13, 2025

⚠️ No Changeset found

Latest commit: 0348926

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented May 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2025 9:43am
engineering ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2025 9:43am

Copy link
Contributor

coderabbitai bot commented May 13, 2025

📝 Walkthrough

Walkthrough

This change standardizes layout and container components across several dashboard and UI files by replacing custom or locally defined wrappers with new FlexibleContainer, ControlsContainer, ControlsLeft, and ControlsRight components from the @unkey/ui package. It also introduces documentation and usage examples for FlexibleContainer and migrates the previously local controls-container components into the internal UI package.

Changes

File(s) Change Summary
apps/dashboard/app/(app)/apis/[apiId]/_overview/components/controls/index.tsx Refactored layout to use ControlsContainer, ControlsLeft, and ControlsRight from @unkey/ui, replacing nested <div> elements and flexbox utility classes.
apps/dashboard/app/(app)/apis/[apiId]/_overview/logs-client.tsx
apps/dashboard/app/(app)/apis/_components/api-list-client.tsx
apps/dashboard/app/(app)/apis/[apiId]/api-id-navbar.tsx
apps/dashboard/app/(app)/apis/[apiId]/page.tsx
Replaced outer and inner <div> wrappers with FlexibleContainer from @unkey/ui for layout. No change to logic or child components.
apps/dashboard/app/(app)/apis/_components/controls/index.tsx
apps/dashboard/app/(app)/audit/components/controls/index.tsx
apps/dashboard/app/(app)/logs/components/controls/index.tsx
apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/controls/index.tsx
apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/controls/index.tsx
apps/dashboard/app/(app)/ratelimits/_components/controls/index.tsx
Changed import source for ControlsContainer, ControlsLeft, and ControlsRight from a local file to @unkey/ui. No changes to component usage or logic.
apps/dashboard/components/logs/controls-container.tsx Removed the file defining ControlsContainer, ControlsLeft, and ControlsRight as local components.
internal/ui/src/components/container/controls-container.tsx Added new React components: ControlsContainer, ControlsLeft, and ControlsRight, wrapping children with layout and alignment using FlexibleContainer and flexbox.
internal/ui/src/components/container/flexible-container.tsx Introduced new FlexibleContainer component with configurable padding, alignment, and justification, using Tailwind CSS and CVA for variant management.
internal/ui/src/index.ts Exported all entities from flexible-container and controls-container components, making them available in the public API.
apps/engineering/content/design/components/container/flexible-container.example.tsx Added example file demonstrating usage of FlexibleContainer with various padding and alignment options.
apps/engineering/content/design/components/flexible-container.mdx Added documentation for FlexibleContainer, including overview, usage examples, API reference, best practices, and accessibility notes.

Sequence Diagram(s)

sequenceDiagram
    participant PageComponent
    participant @unkey/ui
    participant ChildComponent

    PageComponent->>@unkey/ui: Render FlexibleContainer / ControlsContainer
    @unkey/ui->>ChildComponent: Render children inside layout container
Loading

Possibly related PRs

  • unkeyed/unkey#2667: Introduces the design system including FlexibleContainer and related layout components, which are adopted and referenced in this PR for standardized layout handling.

Suggested reviewers

  • perkinsjr
  • mcstepp
  • chronark

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 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 a0c68d3 and f9114f5.

📒 Files selected for processing (1)
  • apps/dashboard/app/(app)/apis/[apiId]/_overview/components/controls/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/app/(app)/apis/[apiId]/_overview/components/controls/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms (25)
  • GitHub Check: Test Go API Local / Test (Shard 3/8)
  • GitHub Check: Test Go API Local / Test (Shard 8/8)
  • GitHub Check: Test Go API Local / Test (Shard 6/8)
  • GitHub Check: Test Go API Local / Test (Shard 1/8)
  • GitHub Check: Test Go API Local / Test (Shard 2/8)
  • GitHub Check: Test Go API Local / Test (Shard 7/8)
  • GitHub Check: Test Go API Local / Test (Shard 4/8)
  • GitHub Check: Test Go API Local / Test (Shard 5/8)
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Build / Build
  • GitHub Check: Test Packages / Test ./apps/dashboard
  • GitHub Check: Test Packages / Test ./packages/hono
  • GitHub Check: Test Packages / Test ./packages/nextjs
  • GitHub Check: Test Packages / Test ./internal/hash
  • GitHub Check: Test Packages / Test ./packages/rbac
  • GitHub Check: Test Packages / Test ./internal/keys
  • GitHub Check: Test Packages / Test ./internal/clickhouse
  • GitHub Check: Test Packages / Test ./packages/cache
  • GitHub Check: Test Packages / Test ./internal/encryption
  • GitHub Check: Test Packages / Test ./internal/id
  • GitHub Check: Test Packages / Test ./packages/api
  • GitHub Check: Test Packages / Test ./internal/resend
  • GitHub Check: Test Packages / Test ./internal/billing
  • GitHub Check: autofix
  • GitHub Check: Analyze (javascript-typescript)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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
Contributor

github-actions bot commented May 13, 2025

Thank you for following the naming conventions for pull request titles! 🙏

@MichaelUnkey MichaelUnkey marked this pull request as ready for review May 13, 2025 18:35
@MichaelUnkey MichaelUnkey enabled auto-merge May 13, 2025 18:35
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: 1

🔭 Outside diff range comments (1)
apps/dashboard/app/(app)/apis/[apiId]/page.tsx (1)

14-24: ⚠️ Potential issue

Preserve full-screen height styling
The original <div className="min-h-screen"> enforced full-screen height. The new <FlexibleContainer> lacks this, which may alter layout. Re-add the class or equivalent prop.

- <FlexibleContainer>
+ <FlexibleContainer className="min-h-screen">
♻️ Duplicate comments (2)
apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/controls/index.tsx (1)

1-1: Import updated to shared UI package
This mirrors the change in other control components. Ensure default styling consistency as noted above.

apps/dashboard/app/(app)/ratelimits/_components/controls/index.tsx (1)

1-1: Import updated to shared UI package
Consistent with other control container migrations. Verify that LogsSearch continues to accept the setNamespaces and initialNamespaces props after this change.

🧹 Nitpick comments (3)
apps/dashboard/app/(app)/apis/[apiId]/api-id-navbar.tsx (1)

33-34: Use component props for alignment and padding
Instead of embedding justify-start and items-start in className, leverage the justify="start" and align="start" props for clarity and consistency.

- <FlexibleContainer padding="none" className="m-0 p-0 justify-start items-start">
+ <FlexibleContainer padding="none" justify="start" align="start" className="m-0 p-0">
apps/dashboard/app/(app)/apis/[apiId]/_overview/logs-client.tsx (1)

24-37: Consider specifying explicit props for FlexibleContainer components.

While the replacement of divs with FlexibleContainer is good for standardization, consider explicitly specifying props like padding, align, and justify to ensure consistent behavior across different usages of FlexibleContainer. In the api-list-client.tsx file, padding="none" was explicitly set, but no props are specified here.

internal/ui/src/components/container/controls-container.tsx (1)

16-22: Clean implementation of ControlsLeft and ControlsRight components.

Both components provide semantic structure for organizing controls on either side of the container with consistent styling.

Consider adding optional className props to these components for additional customization flexibility, similar to ControlsContainer:

-export function ControlsLeft({ children }: { children: React.ReactNode }) {
-  return <div className="flex gap-2">{children}</div>;
+export function ControlsLeft({ 
+  children, 
+  className 
+}: { 
+  children: React.ReactNode; 
+  className?: string 
+}) {
+  return <div className={cn("flex gap-2", className)}>{children}</div>;
}

-export function ControlsRight({ children }: { children: React.ReactNode }) {
-  return <div className="flex gap-2">{children}</div>;
+export function ControlsRight({ 
+  children,
+  className
+}: { 
+  children: React.ReactNode;
+  className?: string
+}) {
+  return <div className={cn("flex gap-2", className)}>{children}</div>;
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f87623b and a0c68d3.

📒 Files selected for processing (17)
  • apps/dashboard/app/(app)/apis/[apiId]/_overview/components/controls/index.tsx (1 hunks)
  • apps/dashboard/app/(app)/apis/[apiId]/_overview/logs-client.tsx (2 hunks)
  • apps/dashboard/app/(app)/apis/[apiId]/api-id-navbar.tsx (3 hunks)
  • apps/dashboard/app/(app)/apis/[apiId]/page.tsx (3 hunks)
  • apps/dashboard/app/(app)/apis/_components/api-list-client.tsx (3 hunks)
  • apps/dashboard/app/(app)/apis/_components/controls/index.tsx (1 hunks)
  • apps/dashboard/app/(app)/audit/components/controls/index.tsx (1 hunks)
  • apps/dashboard/app/(app)/logs/components/controls/index.tsx (1 hunks)
  • apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/controls/index.tsx (1 hunks)
  • apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/controls/index.tsx (1 hunks)
  • apps/dashboard/app/(app)/ratelimits/_components/controls/index.tsx (1 hunks)
  • apps/dashboard/components/logs/controls-container.tsx (0 hunks)
  • apps/engineering/content/design/components/container/flexible-container.example.tsx (1 hunks)
  • apps/engineering/content/design/components/flexible-container.mdx (1 hunks)
  • internal/ui/src/components/container/controls-container.tsx (1 hunks)
  • internal/ui/src/components/container/flexible-container.tsx (1 hunks)
  • internal/ui/src/index.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/dashboard/components/logs/controls-container.tsx
🧰 Additional context used
🧬 Code Graph Analysis (4)
apps/dashboard/app/(app)/apis/[apiId]/api-id-navbar.tsx (1)
internal/ui/src/components/container/flexible-container.tsx (1)
  • FlexibleContainer (37-49)
apps/dashboard/app/(app)/apis/[apiId]/page.tsx (1)
internal/ui/src/components/container/flexible-container.tsx (1)
  • FlexibleContainer (37-49)
internal/ui/src/components/container/flexible-container.tsx (1)
apps/dashboard/lib/utils.ts (1)
  • cn (5-7)
apps/dashboard/app/(app)/apis/_components/api-list-client.tsx (1)
internal/ui/src/components/container/flexible-container.tsx (1)
  • FlexibleContainer (37-49)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Test Go API Local / Test (Shard 5/8)
  • GitHub Check: Test Go API Local / Test (Shard 1/8)
  • GitHub Check: Test Go API Local / Test (Shard 4/8)
  • GitHub Check: Test Go API Local / Test (Shard 3/8)
  • GitHub Check: Test Go API Local / Test (Shard 2/8)
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Build / Build
🔇 Additional comments (25)
internal/ui/src/components/container/flexible-container.tsx (1)

1-52: Well-designed FlexibleContainer component with appropriate variants

This new component provides a flexible container with customizable padding, alignment, and justification options. It's a good abstraction that will help standardize layout patterns across the dashboard.

A few observations:

  • Good use of class-variance-authority for managing Tailwind CSS classes with variants
  • Appropriate defaults (centered alignment and justification with no padding)
  • Well-typed props that extend HTML div attributes

The component design aligns well with the PR objectives of standardizing container components.

apps/dashboard/app/(app)/audit/components/controls/index.tsx (1)

2-2: Import update looks good

The change to import control container components from @unkey/ui instead of a local path centralizes these components appropriately, improving maintainability without changing functionality.

apps/dashboard/app/(app)/apis/_components/controls/index.tsx (1)

2-2: Import update looks good

The change to import control container components from @unkey/ui instead of a local path centralizes these components appropriately, improving maintainability without changing functionality.

apps/dashboard/app/(app)/logs/components/controls/index.tsx (1)

2-2: Import update looks good

The change to import control container components from @unkey/ui instead of a local path centralizes these components appropriately, improving maintainability without changing functionality.

apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/controls/index.tsx (2)

2-2:

✅ Verification successful

Centralize control container imports
Good update replacing local control container components with the shared @unkey/ui package. Ensure that @unkey/ui is added to your project’s dependencies.


🏁 Script executed:

#!/bin/bash
# Verify that @unkey/ui is declared in package.json
rg '"@unkey/ui"' -n package.json

Length of output: 34


🏁 Script executed:

#!/bin/bash
# Search all package.json files for @unkey/ui
rg '"@unkey/ui"' -n -g 'package.json'

Length of output: 215


@unkey/ui dependency confirmed
Great work centralizing the control container imports. I’ve verified that @unkey/ui is declared in apps/dashboard/package.json. Code changes approved.


12-27:

✅ Verification successful

Validate default ControlsContainer styling
The new ControlsContainer may have different default padding or alignment compared to the previous local implementation. Please confirm it matches the existing layout or explicitly pass props (e.g., padding="none", justify="between") if needed.


🏁 Script executed:

#!/bin/bash
# Inspect default props for ControlsContainer in UI package
rg -A3 'export const ControlsContainer' internal/ui/src/components/container/controls-container.tsx

Length of output: 101


🏁 Script executed:

#!/bin/bash
set -e

# Locate the ControlsContainer component file(s)
echo "Searching for controls-container.tsx..."
file_paths=$(fd controls-container.tsx)

if [ -z "$file_paths" ]; then
  echo "No controls-container.tsx file found in the repo."
  exit 1
fi

echo "Found:"
echo "$file_paths"

# Print the first 200 lines of each to inspect default props
for path in $file_paths; do
  echo -e "\n=== $path (first 200 lines) ==="
  sed -n '1,200p' "$path"
done

Length of output: 1591


No changes needed: ControlsContainer defaults match existing layout
Verified that ControlsContainer in internal/ui/src/components/container/controls-container.tsx already uses padding="none" on its FlexibleContainer and applies justify-between in the inner div (className="… justify-between …"), along with px-3 py-2 for spacing. No additional props are required.

apps/dashboard/app/(app)/apis/[apiId]/api-id-navbar.tsx (1)

7-7:

✅ Verification successful

Centralize layout container import
Updated to import FlexibleContainer from @unkey/ui. Ensure the package dependency is declared.


🏁 Script executed:

#!/bin/bash
# Verify that @unkey/ui is declared in package.json
rg '"@unkey/ui"' -n package.json

Length of output: 34


🏁 Script executed:

#!/bin/bash
# Search all package.json files for @unkey/ui declaration
echo "Scanning package.json files for @unkey/ui..."
find . -type f -name "package.json" -print | while read -r file; do
  echo ">> $file"
  grep -n '"@unkey/ui"' "$file" || echo "   — not found"
done

Length of output: 7046


Dependency declaration confirmed
Verified that @unkey/ui is declared in apps/dashboard/package.json (line 59). No further action needed.

apps/dashboard/app/(app)/apis/[apiId]/page.tsx (1)

4-4:

✅ Verification successful

Centralize layout container import
Imported FlexibleContainer from @unkey/ui. Confirm the dependency is present.


🏁 Script executed:

#!/bin/bash
# Verify that @unkey/ui is declared in package.json
rg '"@unkey/ui"' -n package.json

Length of output: 34


🏁 Script executed:

#!/bin/bash
# Search all package.json files for @unkey/ui
echo "🔍 Searching all package.json files for @unkey/ui..."
find . -type f -name 'package.json' -print -exec rg '"@unkey/ui"' -n {} +

# Check pnpm lockfile if present
if [ -f pnpm-lock.yaml ]; then
  echo "🔍 Checking pnpm-lock.yaml for unkey/ui..."
  rg 'unkey/ui' -n pnpm-lock.yaml || echo "No entries found in pnpm-lock.yaml"
fi

# Check yarn lockfile if present
if [ -f yarn.lock ]; then
  echo "🔍 Checking yarn.lock for unkey/ui..."
  rg 'unkey/ui' -n yarn.lock || echo "No entries found in yarn.lock"
fi

Length of output: 1724


Verified @unkey/ui Dependency
Confirmed that @unkey/ui is declared in apps/dashboard/package.json (line 59) and present in the lockfile. The import of FlexibleContainer is valid.

internal/ui/src/index.ts (1)

14-15: LGTM - Clean export additions for the new container components.

The new export statements follow the established pattern and make the container components available throughout the application, which aligns with the PR objective of standardizing container components across the dashboard.

apps/dashboard/app/(app)/apis/_components/api-list-client.tsx (2)

9-9: LGTM - Proper import of the new FlexibleContainer component.

The import statement correctly adds the FlexibleContainer component from @unkey/ui alongside existing imports.


25-59: LGTM - Good replacement of custom div with standardized FlexibleContainer.

The div with flex styling has been appropriately replaced with the standardized FlexibleContainer component. The padding="none" prop ensures the layout maintains the same spacing as before.

apps/dashboard/app/(app)/apis/[apiId]/_overview/logs-client.tsx (1)

4-4: LGTM - FlexibleContainer import added correctly.

The import statement correctly adds the FlexibleContainer component from @unkey/ui.

apps/dashboard/app/(app)/apis/[apiId]/_overview/components/controls/index.tsx (1)

1-1: LGTM - Proper imports for the controls container components.

The import statement correctly imports the ControlsContainer, ControlsLeft, and ControlsRight components from @unkey/ui.

apps/engineering/content/design/components/flexible-container.mdx (6)

1-11: Well-structured documentation frontmatter and imports.

The frontmatter and imports section provides clear information about the component and correctly imports all necessary example components.

Consider adding a simple installation and import instruction section to help developers quickly integrate this component:

## Installation and Import

```jsx
import { FlexibleContainer } from "@unkey/ui";

---

`13-16`: **Clear overview of the component's purpose.**

The overview effectively communicates the component's purpose and key features.


Consider enhancing this section with a basic code example to illustrate typical usage:

```markdown
```jsx
<FlexibleContainer padding="medium" align="center" justify="center">
  <YourContent />
</FlexibleContainer>

---

`17-48`: **Excellent examples section with progression from simple to complex.**

The examples section effectively demonstrates the various padding options and alignment settings available in the component. The progression from default to custom configurations provides a clear understanding of the component's capabilities.

---

`49-57`: **Comprehensive props documentation.**

The props table is well-formatted and includes all necessary information about the component's props, including types, default values, and descriptions.

---

`58-64`: **Helpful best practices section.**

The best practices section provides valuable guidance for using the component effectively.


Consider adding a concrete example for combining with other layout components, as mentioned in the third bullet point:

```markdown
For example, combining with Card component:
```jsx
<FlexibleContainer padding="medium">
  <Card>
    <CardContent>Your content here</CardContent>
  </Card>
</FlexibleContainer>

---

`65-67`: **Good accessibility note, but could be expanded.**

The accessibility section acknowledges the importance of proper spacing and alignment for users with disabilities.


Consider expanding this section with more specific guidance:

```markdown
Consider the following accessibility aspects when using this component:

- Maintain sufficient spacing between interactive elements (at least 8px) to help users with motor control difficulties
- Ensure text within containers has sufficient color contrast with backgrounds
- Use consistent alignment patterns throughout your application to help users with cognitive disabilities
apps/engineering/content/design/components/container/flexible-container.example.tsx (4)

1-5: Proper setup with client directive and imports.

The file correctly includes the "use client" directive and imports all necessary components from appropriate paths.


6-38: Well-structured default and small padding examples.

Both DefaultExample and SmallExample components follow consistent patterns and effectively demonstrate their respective padding options. The examples use appropriate background colors and contain enough content to clearly illustrate the container's behavior.


40-72: Consistent medium and large padding examples.

The MediumExample and LargeExample components maintain the established pattern and clearly demonstrate the "medium" and "large" padding options. The consistency across all examples makes the differences in padding sizes easy to understand.


74-115: Comprehensive custom alignment example with multiple configurations.

The CustomExample component effectively demonstrates various alignment and justification combinations, showcasing the flexibility of the component. The layout is well-organized with appropriate flex containers and spacing.

The comment on line 104 about the height workaround could be more specific to help other developers understand the issue:

-        {/* Needed to get height to work properly in RenderComponentWithSnippet */}
+        {/* These elements act as spacers to ensure consistent height rendering within 
+            RenderComponentWithSnippet, which otherwise collapses without minimum content */}
internal/ui/src/components/container/controls-container.tsx (2)

1-4: Clear comment and appropriate imports.

The biome-ignore comment clearly explains why React is imported even though no React APIs are used directly. All necessary dependencies are properly imported.


5-14: Well-implemented ControlsContainer component.

The ControlsContainer component effectively wraps children in a FlexibleContainer with appropriate styling. It properly handles the optional className prop using the cn utility function to merge with default styles.

@ogzhanolguncu
Copy link
Contributor

image

Total height of the controller container should be 40px according to our old design. Probably at some point we made a mistake and made it 48px. So, let's fix it properly this time. Removing py-2 from it should be enough.

Copy link
Contributor

@ogzhanolguncu ogzhanolguncu left a comment

Choose a reason for hiding this comment

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

This new FlexibleContainer looks and feels nice, but I still don't know when to reach for it. My point is, if a contributor is trying to add something new, how can we make it more intuitive to use FlexibleContainer rather than div.flex.flex-col?

Copy link
Collaborator Author

My thought process : 1.Make a simple container now to be used around the site.

Copy link
Collaborator Author

  1. to update it when more situations arise with variants and things as needed to keep consistency

Copy link
Contributor

So when I need a div with flex I use this instead?

Copy link
Collaborator

mcstepp commented May 16, 2025

I'm gonna ask a probably weird question.

Do we have any style guides published? This kind of thing feels like it would go well in a style guide

Copy link
Contributor

Don't think we have one

Copy link
Collaborator

Let’s brainstorm in iceland

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.

4 participants