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

feat(components): add "Device Mockups" #1410

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

SutuSebastian
Copy link
Collaborator

@SutuSebastian SutuSebastian commented May 29, 2024

Changes

Result

Screenshot 2024-05-29 at 19 07 56

Summary by CodeRabbit

  • New Features

    • Introduced customizable mockup components: DefaultMockup, DesktopMockup, GooglePixelMockup, IPhone12Mockup, LaptopMockup, and SmartwatchMockup.
    • Each mockup component now supports custom themes for enhanced flexibility in design.
  • Documentation

    • Updated example files to demonstrate the usage of new mockup components and their theming capabilities.

@SutuSebastian SutuSebastian added the 🎯 new component This is a new component label May 29, 2024
@SutuSebastian SutuSebastian self-assigned this May 29, 2024
Copy link

changeset-bot bot commented May 29, 2024

🦋 Changeset detected

Latest commit: 6e1c6e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
flowbite-react Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

vercel bot commented May 29, 2024

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

Name Status Preview Comments Updated (UTC)
flowbite-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:55am
flowbite-react-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:55am

Copy link
Contributor

coderabbitai bot commented May 29, 2024

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent changes introduce customizable themes for various mockup components in the packages/ui/src/components/Mockup directory. Components like DefaultMockup, DesktopMockup, GooglePixelMockup, IPhone12Mockup, LaptopMockup, and SmartwatchMockup now support theme customization through new properties. Additionally, example files in the apps/web/examples/mockup directory have been updated to demonstrate the usage of these mockup components with customizable themes.

Changes

Files Change Summary
packages/ui/src/components/Mockup/DefaultMockup.tsx Added theme customization support to DefaultMockup component
packages/ui/src/components/Mockup/DesktopMockup.tsx Added theme customization support to DesktopMockup component
packages/ui/src/components/Mockup/GooglePixelMockup.tsx Added theme customization support to GooglePixelMockup component
packages/ui/src/components/Mockup/IPhone12Mockup.tsx Added theme customization support to IPhone12Mockup component
packages/ui/src/components/Mockup/LaptopMockup.tsx Added theme customization support to LaptopMockup component
packages/ui/src/components/Mockup/SmartwatchMockup.tsx Added theme customization support to SmartwatchMockup component
apps/web/examples/mockup/mockup.desktop.tsx Updated to demonstrate DesktopMockup with theme customization
apps/web/examples/mockup/mockup.googlePixel.tsx Updated to demonstrate GooglePixelMockup with theme customization
apps/web/examples/mockup/mockup.laptop.tsx Updated to demonstrate LaptopMockup with theme customization
apps/web/examples/mockup/mockup.smartwatch.tsx Updated to demonstrate SmartwatchMockup with theme customization
apps/web/examples/mockup/mockup.tablet.tsx Updated to demonstrate TabletMockup with theme customization

Poem

In the land of code, where mockups gleam,
Themes now dance, like a vibrant dream.
From laptops to phones, each screen anew,
With colors and styles, just for you.
A rabbit's joy, in every byte,
Customizable themes, a coder's delight!


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.

@SutuSebastian SutuSebastian changed the title Feat/components/device mockups feat(components): add "Device Mockups" May 29, 2024
@coderabbitai coderabbitai bot changed the title feat(components): add "Device Mockups" Feat/components/device mockups May 29, 2024
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: 9

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between b2640bc and 32f11e8.
Files selected for processing (27)
  • .changeset/spicy-eels-press.md (1 hunks)
  • apps/web/components/mdx.tsx (1 hunks)
  • apps/web/content/docs/components/device-mockups.mdx (1 hunks)
  • apps/web/data/docs-sidebar.ts (1 hunks)
  • apps/web/examples/index.ts (1 hunks)
  • apps/web/examples/mockup/index.ts (1 hunks)
  • apps/web/examples/mockup/mockup.colors.tsx (1 hunks)
  • apps/web/examples/mockup/mockup.desktop.tsx (1 hunks)
  • apps/web/examples/mockup/mockup.googlePixel.tsx (1 hunks)
  • apps/web/examples/mockup/mockup.iPhone12.tsx (1 hunks)
  • apps/web/examples/mockup/mockup.laptop.tsx (1 hunks)
  • apps/web/examples/mockup/mockup.root.tsx (1 hunks)
  • apps/web/examples/mockup/mockup.smartwatch.tsx (1 hunks)
  • apps/web/examples/mockup/mockup.tablet.tsx (1 hunks)
  • packages/ui/src/components/Flowbite/FlowbiteTheme.ts (2 hunks)
  • packages/ui/src/components/Mockup/DefaultMockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/DesktopMockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/GooglePixelMockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/IPhone12Mockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/LaptopMockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/Mockup.stories.tsx (1 hunks)
  • packages/ui/src/components/Mockup/SmartwatchMockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/TabletMockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/index.ts (1 hunks)
  • packages/ui/src/components/Mockup/theme.ts (1 hunks)
  • packages/ui/src/index.ts (1 hunks)
  • packages/ui/src/theme.ts (4 hunks)
Files skipped from review due to trivial changes (5)
  • apps/web/content/docs/components/device-mockups.mdx
  • apps/web/data/docs-sidebar.ts
  • apps/web/examples/index.ts
  • apps/web/examples/mockup/index.ts
  • packages/ui/src/components/Mockup/index.ts
Additional Context Used
Biome (17)
apps/web/components/mdx.tsx (2)

68-68: Unexpected any. Specify a different type.


69-69: Change to an optional chain.

apps/web/examples/mockup/mockup.colors.tsx (1)

2-3: All these imports are only used as types.

apps/web/examples/mockup/mockup.desktop.tsx (1)

1-2: All these imports are only used as types.

apps/web/examples/mockup/mockup.googlePixel.tsx (1)

1-2: All these imports are only used as types.

apps/web/examples/mockup/mockup.iPhone12.tsx (1)

1-2: All these imports are only used as types.

apps/web/examples/mockup/mockup.laptop.tsx (1)

1-2: All these imports are only used as types.

apps/web/examples/mockup/mockup.root.tsx (1)

1-2: All these imports are only used as types.

apps/web/examples/mockup/mockup.smartwatch.tsx (1)

1-2: All these imports are only used as types.

apps/web/examples/mockup/mockup.tablet.tsx (1)

1-2: All these imports are only used as types.

packages/ui/src/components/Mockup/DefaultMockup.tsx (1)

1-1: All these imports are only used as types.

packages/ui/src/components/Mockup/DesktopMockup.tsx (1)

1-1: All these imports are only used as types.

packages/ui/src/components/Mockup/GooglePixelMockup.tsx (1)

1-1: All these imports are only used as types.

packages/ui/src/components/Mockup/IPhone12Mockup.tsx (1)

1-1: All these imports are only used as types.

packages/ui/src/components/Mockup/LaptopMockup.tsx (1)

1-1: All these imports are only used as types.

packages/ui/src/components/Mockup/SmartwatchMockup.tsx (1)

1-1: All these imports are only used as types.

packages/ui/src/components/Mockup/TabletMockup.tsx (1)

1-1: All these imports are only used as types.

Additional comments not posted (33)
.changeset/spicy-eels-press.md (1)

5-5: The changeset description is clear and concise.

packages/ui/src/components/Mockup/DesktopMockup.tsx (1)

11-23: The implementation of DesktopMockup is clean and follows best practices for prop spreading and default parameters.

packages/ui/src/components/Mockup/LaptopMockup.tsx (1)

11-24: The LaptopMockup component is well-implemented with clear prop spreading and default parameter usage.

packages/ui/src/components/Mockup/SmartwatchMockup.tsx (1)

11-25: The structure of SmartwatchMockup is robust, utilizing best practices for React component development.

packages/ui/src/components/Mockup/TabletMockup.tsx (1)

12-24: TabletMockup is implemented effectively, adhering to React best practices and clean code principles.

packages/ui/src/components/Mockup/IPhone12Mockup.tsx (1)

12-24: The IPhone12Mockup component is well-crafted, demonstrating good practices in React component design.

packages/ui/src/components/Mockup/DefaultMockup.tsx (1)

8-24: The implementation of DefaultMockup looks clean and follows best practices for theme customization and class merging.

packages/ui/src/components/Mockup/GooglePixelMockup.tsx (1)

8-25: The GooglePixelMockup component is well-implemented, with attention to device-specific details like the notch.

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

27-27: The export of the Mockup component is correctly added, enabling its use in external projects.

apps/web/examples/mockup/mockup.root.tsx (1)

4-81: The example usage of DefaultMockup is well-documented and effectively demonstrates the component's capabilities in different themes.

apps/web/examples/mockup/mockup.iPhone12.tsx (1)

4-81: The example usage of IPhone12Mockup is well-documented and effectively demonstrates the component's capabilities in different themes.

apps/web/examples/mockup/mockup.tablet.tsx (1)

4-81: The example usage of TabletMockup is well-documented and effectively demonstrates the component's capabilities in different themes.

apps/web/examples/mockup/mockup.googlePixel.tsx (2)

4-81: The JSX code for the Google Pixel mockup is well-structured and clear.


48-63: The component definition for displaying the Google Pixel mockup is correctly implemented.

apps/web/examples/mockup/mockup.smartwatch.tsx (3)

4-81: The JSX code for the Smartwatch mockup is well-structured and clear.


48-63: The component definition for displaying the Smartwatch mockup is correctly implemented.


1-2: Ensure imports are correctly used as types if they are not instantiated.

Verification successful

Ensure imports are correctly used as types if they are not instantiated.

The SmartwatchMockup import is instantiated in the JSX, and CodeData is used as a type. Therefore, the imports are correctly used.

  • SmartwatchMockup is used in JSX elements.
  • CodeData is used as a type.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the imports in `mockup.smartwatch.tsx` are used as types only.

# Test: Search for non-type usage of imports. Expect: No occurrences.
rg --type tsx --files-with-matches 'SmartwatchMockup|CodeData' apps/web/examples/mockup/mockup.smartwatch.tsx

Length of output: 139



Script:

#!/bin/bash
# Description: Verify that the imports in `mockup.smartwatch.tsx` are used as types only.

# Test: Search for non-type usage of imports. Expect: No occurrences.
rg 'SmartwatchMockup|CodeData' apps/web/examples/mockup/mockup.smartwatch.tsx

Length of output: 365

apps/web/examples/mockup/mockup.laptop.tsx (2)

4-81: The JSX code for the Laptop mockup is well-structured and clear.


48-63: The component definition for displaying the Laptop mockup is correctly implemented.

apps/web/examples/mockup/mockup.desktop.tsx (2)

4-81: The JSX code for the Desktop mockup is well-structured and clear.


48-63: The component definition for displaying the Desktop mockup is correctly implemented.

apps/web/components/mdx.tsx (2)

Line range hint 1-11: The imports in mdx.tsx are correctly used and structured.


71-71: The Mdx function is correctly implemented to render MDX components dynamically.

apps/web/examples/mockup/mockup.colors.tsx (3)

5-84: The JSX code for the Colors mockup is well-structured and clear, with appropriate theme customization.


51-66: The component definition for displaying the Colors mockup with theme customization is correctly implemented.


1-3: Ensure imports are correctly used as types if they are not instantiated.

packages/ui/src/theme.ts (2)

71-71: Integration of mockupTheme into the main theme object is correctly implemented.


25-25: Ensure that the mockupTheme import path is correct and consistent with the project structure.

Verification successful

The import path for mockupTheme is correct, and it is properly used within the theme object.

  • packages/ui/src/theme.ts: The import path and usage of mockupTheme are verified and correct.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the import path for `mockupTheme`.

# Test: Check if the file exists at the specified path. Expect: File exists.
if [ -f "packages/ui/src/components/Mockup/theme.ts" ]; then
  echo "The import path for mockupTheme is correct."
else
  echo "The import path for mockupTheme is incorrect."
fi

Length of output: 152



Script:

#!/bin/bash
# Description: Verify the usage of `mockupTheme` within the theme object.

# Test: Check if `mockupTheme` is used in the theme object in `packages/ui/src/theme.ts`.
rg 'mockupTheme' packages/ui/src/theme.ts

Length of output: 121

packages/ui/src/components/Mockup/Mockup.stories.tsx (2)

12-14: Story configuration for Mockup components is correctly set up in Storybook.


16-28: All mockup stories are correctly implemented, showcasing various device mockups with appropriate images and classes.

Also applies to: 31-43, 46-58, 61-73, 76-88, 91-103, 106-118, 121-133

packages/ui/src/components/Flowbite/FlowbiteTheme.ts (2)

73-73: Integration of FlowbiteMockupTheme into the FlowbiteTheme interface is correctly implemented.


25-25: Ensure that the FlowbiteMockupTheme import path is correct and consistent with the project structure.

packages/ui/src/components/Mockup/theme.ts (1)

3-12: All mockup themes are defined with appropriate styles and properties, ensuring a consistent and visually appealing presentation across different devices.

Also applies to: 14-23, 25-35, 37-46, 48-56, 58-65, 67-79, 81-89

packages/ui/src/components/Mockup/DesktopMockup.tsx Outdated Show resolved Hide resolved
packages/ui/src/components/Mockup/LaptopMockup.tsx Outdated Show resolved Hide resolved
packages/ui/src/components/Mockup/SmartwatchMockup.tsx Outdated Show resolved Hide resolved
packages/ui/src/components/Mockup/TabletMockup.tsx Outdated Show resolved Hide resolved
packages/ui/src/components/Mockup/IPhone12Mockup.tsx Outdated Show resolved Hide resolved
apps/web/examples/mockup/mockup.laptop.tsx Show resolved Hide resolved
apps/web/examples/mockup/mockup.desktop.tsx Outdated Show resolved Hide resolved
@themesberg themesberg deleted a comment from coderabbitai bot May 30, 2024
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 32f11e8 and a2f8a11.

Files selected for processing (7)
  • packages/ui/src/components/Mockup/DefaultMockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/DesktopMockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/GooglePixelMockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/IPhone12Mockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/LaptopMockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/SmartwatchMockup.tsx (1 hunks)
  • packages/ui/src/components/Mockup/TabletMockup.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (7)
  • packages/ui/src/components/Mockup/DefaultMockup.tsx
  • packages/ui/src/components/Mockup/DesktopMockup.tsx
  • packages/ui/src/components/Mockup/GooglePixelMockup.tsx
  • packages/ui/src/components/Mockup/IPhone12Mockup.tsx
  • packages/ui/src/components/Mockup/LaptopMockup.tsx
  • packages/ui/src/components/Mockup/SmartwatchMockup.tsx
  • packages/ui/src/components/Mockup/TabletMockup.tsx

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a2f8a11 and 2805b52.

Files selected for processing (5)
  • apps/web/examples/mockup/mockup.desktop.tsx (1 hunks)
  • apps/web/examples/mockup/mockup.googlePixel.tsx (1 hunks)
  • apps/web/examples/mockup/mockup.laptop.tsx (1 hunks)
  • apps/web/examples/mockup/mockup.smartwatch.tsx (1 hunks)
  • apps/web/examples/mockup/mockup.tablet.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (5)
  • apps/web/examples/mockup/mockup.desktop.tsx
  • apps/web/examples/mockup/mockup.googlePixel.tsx
  • apps/web/examples/mockup/mockup.laptop.tsx
  • apps/web/examples/mockup/mockup.smartwatch.tsx
  • apps/web/examples/mockup/mockup.tablet.tsx

fix(storybook): example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎯 new component This is a new component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant