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

Add Static CSS and Flex Component for Yorkie Homepage #145

Merged
merged 3 commits into from
Aug 6, 2024

Conversation

chacha912
Copy link
Contributor

@chacha912 chacha912 commented Aug 6, 2024

What this PR does / why we need it:

I added the static CSS and Flex component because they were needed to replace the button component on the Yorkie Homepage.: yorkie-team/yorkie-team.github.io#155

Special notes for your reviewer:

I added only the necessary styles to the static CSS, but since we can't predict which styles users will use, we might need to prepare all styles in static CSS. This could increase the size and build time, so I'm considering whether to structure the Yorkie UI in a copy-paste format like Park UI or Shadcn UI.

Which issue(s) this PR fixes:

Fixes #

Checklist:

  • Added relevant tests or not required
  • Didn't break anything

Summary by CodeRabbit

  • New Features

    • Added a new Flex component for improved flexible layout management.
    • Expanded color palette options for button customization.
    • Introduced a Flex documentation page and stories to showcase its capabilities.
  • Bug Fixes

    • Downgraded @storybook/addon-themes for better compatibility.
  • Refactor

    • Streamlined color token management by importing from a dedicated module.
    • Adjusted breakpoint values to optimize responsive design.
  • Documentation

    • Created comprehensive documentation for the new Flex component, including usage examples and props details.

@CLAassistant
Copy link

CLAassistant commented Aug 6, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

coderabbitai bot commented Aug 6, 2024

Warning

Rate limit exceeded

@chacha912 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 52 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between caff8a2 and 255c7dd.

Walkthrough

The recent changes enhance the Storybook application by refining component documentation and layouts, introducing a new Flex component for improved UI flexibility, and updating configuration files for better responsive design. The overall goal is to streamline the styling process and expand customization options while maintaining a cohesive look and feel across the application.

Changes

Files Change Summary
apps/storybook/package.json Downgraded @storybook/addon-themes from ^8.2.6 to ^8.2.5.
apps/storybook/src/stories/button/*.mdx Replaced <div> with <Flex> in button stories for better layout control, added note about unimplemented link styles.
apps/storybook/src/stories/button/Button.stories.tsx Updated button stories to utilize Flex for layout, expanded colorPalette from 10 to 14 options, and improved spacing and alignment with new Flex implementation.
apps/storybook/src/stories/flex/*.mdx Introduced documentation for the Flex component, including usage examples and props section.
packages/core/panda.config.ts Added numerous properties for improved styling and layout management, including flexbox and visibility controls.
packages/core/panda/theme/breakpoints.ts Adjusted breakpoint sizes for responsive design; increased md, lg, and xl values, removed 2xl.
packages/core/panda/theme/semantic-tokens/colors.ts New file defining semantic color tokens for a design system.
packages/core/panda/theme/semantic-tokens/index.ts Refactored color token management by importing colors from a separate file, reducing inline complexity.
packages/core/panda/theme/semantic-tokens/shadows.ts Reset shadow definitions to an empty object, removing all previously defined styles.
packages/core/panda/theme/tokens/z-index.ts Added float property to zIndex definition to manage stacking order.
packages/core/src/flex/*.tsx Implemented a new Flex component for flexible layout management, utilizing forwardRef for DOM interaction.
packages/core/src/index.ts Expanded exports to include the new Flex functionality alongside existing button exports.

Sequence Diagram(s)

sequenceDiagram
    participant A as User
    participant B as Storybook
    participant C as Flex Component
    participant D as Button Component

    A->>B: Open Storybook
    B->>D: Render Button Stories
    D->>C: Use Flex for Layout
    C->>B: Return Rendered Flex Layout
    B->>A: Display Updated Button Stories
Loading

🐰 In the meadow, hopping free,
A Flex design, what glee to see!
Buttons dance in perfect line,
Colors bright and layout fine.
With every click, my heart takes flight,
Oh, how changes make the world so bright! 🌈✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

@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, codebase verification and nitpick comments (1)
packages/core/src/flex/Flex.tsx (1)

7-15: Consider adding prop types for better documentation.

Adding prop types can improve the documentation and usability of the component.

+  /**
+   * The direction of the flex container.
+   */
+  direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';

+  /**
+   * Used to align child elements along the main axis of the container.
+   */
+  justify?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';

+  /**
+   * Used to align child elements along the cross axis of the container.
+   */
+  align?: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';

+  /**
+   * The gap between flex items.
+   */
+  gap?: number;
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4eb3aa7 and caff8a2.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (14)
  • apps/storybook/package.json (1 hunks)
  • apps/storybook/src/stories/button/Button.mdx (6 hunks)
  • apps/storybook/src/stories/button/Button.stories.tsx (5 hunks)
  • apps/storybook/src/stories/flex/Flex.mdx (1 hunks)
  • apps/storybook/src/stories/flex/Flex.stories.tsx (1 hunks)
  • packages/core/panda.config.ts (1 hunks)
  • packages/core/panda/theme/breakpoints.ts (1 hunks)
  • packages/core/panda/theme/semantic-tokens/colors.ts (1 hunks)
  • packages/core/panda/theme/semantic-tokens/index.ts (1 hunks)
  • packages/core/panda/theme/semantic-tokens/shadows.ts (1 hunks)
  • packages/core/panda/theme/tokens/z-index.ts (3 hunks)
  • packages/core/src/flex/Flex.tsx (1 hunks)
  • packages/core/src/flex/index.ts (1 hunks)
  • packages/core/src/index.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • apps/storybook/package.json
  • packages/core/src/flex/index.ts
Additional context used
LanguageTool
apps/storybook/src/stories/flex/Flex.mdx

[uncategorized] ~30-~30: Loose punctuation mark.
Context: ... 4 `, }} /> ## Props

(UNLIKELY_OPENING_PUNCTUATION)

Additional comments not posted (32)
packages/core/src/index.ts (1)

2-2: LGTM! Verify the existence and correctness of the flex module.

The code changes are approved.

Ensure that the flex module is correctly implemented and available.

Verification successful

The flex module is correctly implemented and available.

The flex module located at packages/core/src/flex/Flex.tsx contains the following export statements:

  • export type FlexProps = HTMLStyledProps<'div'> & FlexProperties;
  • export const Flex = forwardRef<HTMLDivElement, FlexProps>((props: FlexProps, ref) => { ... });

This confirms that the module is correctly implemented and exports the necessary entities.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and correctness of the `flex` module.

# Test: Check for the existence of the `flex` module. Expect: The file exists.
fd 'flex.ts' packages/core/src

# Test: Check for the export statement in the `flex` module. Expect: The module exports entities.
rg --type ts 'export' packages/core/src/flex.ts

Length of output: 176


Script:

#!/bin/bash
# Description: Verify the existence and correctness of the `flex` module.

# Test: Check for the export statement in the `flex` module. Expect: The module exports entities.
rg --type tsx 'export' packages/core/src/flex/Flex.tsx

Length of output: 82


Script:

#!/bin/bash
# Description: Verify the existence and correctness of the `flex` module.

# Test: Check for the export statement in the `flex` module. Expect: The module exports entities.
rg --type typescript 'export' packages/core/src/flex/Flex.tsx

Length of output: 96


Script:

#!/bin/bash
# Description: Verify the existence and correctness of the `flex` module.

# Test: Check for the export statement in the `flex` module. Expect: The module exports entities.
rg 'export' packages/core/src/flex/Flex.tsx

Length of output: 195

packages/core/panda/theme/breakpoints.ts (1)

3-6: Verify alignment with design requirements and impact on layout.

The breakpoint values have been significantly altered. Ensure that these changes align with the overall design requirements and do not introduce layout issues.

packages/core/panda/theme/semantic-tokens/shadows.ts (1)

3-3: Verify the impact on the visual appearance of the UI.

All shadow definitions have been removed. Ensure that this change does not negatively impact the visual appearance of the UI.

packages/core/panda/theme/semantic-tokens/index.ts (2)

7-9: LGTM! The function definition is simplified and maintainable.

The function now uses the imported colors and shadows objects, which enhances maintainability.


3-3: Ensure the colors import is correct.

The colors object is now imported from ./colors. Verify that the colors module exports the expected structure.

Verification successful

The colors import is correct.

The colors object is correctly exported from the colors module.

  • export const colors = defineSemanticTokens.colors({
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `colors` module exports the expected structure.

# Test: Search for the `colors` export. Expect: The `colors` object is correctly exported.
rg --type javascript -A 5 $'export const colors'

Length of output: 84


Script:

#!/bin/bash
# Locate the file containing the `colors` export and verify its structure.

# Find the file named `colors` in the `packages/core/panda/theme/semantic-tokens` directory.
fd colors packages/core/panda/theme/semantic-tokens --extension ts --exec rg 'export const colors' {}

Length of output: 157

packages/core/panda/theme/tokens/z-index.ts (1)

10-12: LGTM! The new float property enhances functionality.

The new float property with a value of 1 provides an additional option for managing element visibility and layering.

apps/storybook/src/stories/flex/Flex.mdx (1)

1-36: LGTM! The documentation for the Flex component is clear and complete.

The file includes sections for import, overview, and props, providing a comprehensive guide for using the Flex component.

Tools
LanguageTool

[uncategorized] ~30-~30: Loose punctuation mark.
Context: ... 4 `, }} /> ## Props

(UNLIKELY_OPENING_PUNCTUATION)

packages/core/src/flex/Flex.tsx (3)

1-3: LGTM!

The import statements are necessary and correctly used.


5-6: LGTM!

The type definition correctly extends HTMLStyledProps and FlexProperties.


7-15: LGTM!

The Flex component correctly handles props and applies styles using styled-system.

apps/storybook/src/stories/flex/Flex.stories.tsx (4)

1-3: LGTM!

The import statements are necessary and correctly used.


4-6: LGTM!

The property arrays are correctly defined and used.


7-45: LGTM!

The meta object is correctly defined and used.


47-62: LGTM!

The story object is correctly defined and used.

apps/storybook/src/stories/button/Button.mdx (3)

Line range hint 50-60:
LGTM!

The <Flex> component is correctly used and improves the layout for the Sizes example.


69-70: LGTM!

The note about the link style is clear and informative.


Line range hint 76-86:
LGTM!

The <Flex> component is correctly used and improves the layout for the Variant example.

packages/core/panda.config.ts (4)

24-28: Visibility Control Properties Added.

The properties hideFrom and hideBelow are correctly added to enhance responsive design capabilities.


30-41: Flexbox Layout Properties Added.

The properties related to flexbox layout are correctly added, providing detailed control over element arrangement within a flex container.


43-52: Positioning Properties Added.

The properties for positioning are correctly added, providing tools for controlling the stacking context and positioning of elements.


54-70: Dimension and Margin/Padding Control Properties Added.

The properties for width, height, minWidth, minHeight, margin, and padding are correctly added, allowing for precise control over element sizing and spacing.

apps/storybook/src/stories/button/Button.stories.tsx (3)

2-2: Import Statement Updated.

The import statement is correctly updated to include the Flex component from @yorkie-ui/core.


42-58: Expanded colorPalette Options.

The colorPalette options are correctly expanded to include a broader selection of predefined color palettes.


Line range hint 88-98:
Improved Layout Control with Flex Component.

The Flex component is correctly used to wrap the buttons in the Sizes and Variant story exports, improving layout control and visual presentation.

Also applies to: 106-116

packages/core/panda/theme/semantic-tokens/colors.ts (8)

3-54: Gray Color Definitions Added.

The various shades of gray are correctly defined using semantic tokens.


55-90: Red Color Definitions Added.

The various shades of red are correctly defined using semantic tokens.


91-126: Orange Color Definitions Added.

The various shades of orange are correctly defined using semantic tokens.


127-162: Yellow Color Definitions Added.

The various shades of yellow are correctly defined using semantic tokens.


163-198: Green Color Definitions Added.

The various shades of green are correctly defined using semantic tokens.


199-234: Blue Color Definitions Added.

The various shades of blue are correctly defined using semantic tokens.


235-270: Purple Color Definitions Added.

The various shades of purple are correctly defined using semantic tokens.


271-420: Remaining Color Definitions Added.

The remaining color categories such as white, transparent, disabled, accent, neutral, success, info, warning, and danger are correctly defined using semantic tokens.

@chacha912 chacha912 merged commit a03e5bf into main Aug 6, 2024
2 checks passed
@chacha912 chacha912 deleted the refactor-button branch August 6, 2024 05:46
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.

2 participants