-
-
Notifications
You must be signed in to change notification settings - Fork 456
feat(components): add "Device Mockups" #1410
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
Draft
SutuSebastian
wants to merge
11
commits into
main
Choose a base branch
from
feat/components/device-mockups
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
dcfbb1c
feat(components): add "Device Mockups"
SutuSebastian 32f11e8
chore: changeset
SutuSebastian a2f8a11
fix: import types
SutuSebastian 2805b52
fix typo
SutuSebastian f781756
refactor(docs): simplify examples;
SutuSebastian dcf16e6
refactor laptop mockup structure to make it scalable + fix docs and s…
SutuSebastian c53d0fe
Merge branch 'main' into feat/components/device-mockups
SutuSebastian 560fe7b
Merge branch 'main' into feat/components/device-mockups
SutuSebastian ccbdbf7
Merge remote-tracking branch 'origin/main' into feat/components/devic…
SutuSebastian c05a9ee
remove duplicate
SutuSebastian 6e1c6e0
Merge remote-tracking branch 'origin/main' into feat/components/devic…
SutuSebastian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"flowbite-react": patch | ||
--- | ||
|
||
feat(components): add "Device Mockups" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
--- | ||
title: React Device Mockups - Flowbite | ||
description: Use the device mockups component to add content and screenshot previews of your application inside phone and tablet frames coded with Tailwind CSS and Flowbite | ||
--- | ||
|
||
The device mockup component can be used to feature a preview and screenshot of your application as if you would already use it on a mobile phone and it’s a great use case for hero and CTA sections. | ||
|
||
This component is built using only the utility classes from Tailwind CSS and has built-in dark mode support so it’s easy to customize, it loads very fast and integrates perfectly with Tailwind CSS and Flowbite. | ||
|
||
You can choose from multiple examples of mockups including phone, tablet, laptop, and even desktop devices with iOS or Android support. | ||
|
||
To start using the mockup components you need to import them from `flowbite-react`: | ||
|
||
```jsx | ||
import { | ||
DefaultMockup, | ||
DesktopMockup, | ||
GooglePixelMockup, | ||
IPhone12Mockup, | ||
LaptopMockup, | ||
SmartwatchMockup, | ||
TabletMockup, | ||
} from "flowbite-react"; | ||
``` | ||
|
||
## Default mockup | ||
|
||
Use this example to show a standard phone mockup based on Tailwind CSS and add your app screenshot inside of it with dark mode support included. | ||
|
||
<Example name="mockup.root" /> | ||
|
||
## iPhone 12 mockup (iOS) | ||
|
||
Use this example to clearly show that the preview of your application is being used on an iPhone with iOS. | ||
|
||
<Example name="mockup.iPhone12" /> | ||
|
||
## Google Pixel (Android) | ||
|
||
Use this alternative phone mockup example if you want to feature previews for android gadgets. | ||
|
||
<Example name="mockup.googlePixel" /> | ||
|
||
## Tablet mockup | ||
|
||
This component can be used to show an application preview inside of a responsive tablet mockup. | ||
|
||
<Example name="mockup.tablet" /> | ||
|
||
## Laptop mockup | ||
|
||
This example can be used to show a screenshot of your application inside a laptop mockup. | ||
|
||
<Example name="mockup.laptop" /> | ||
|
||
## Desktop mockup | ||
|
||
Use this example to show a preview of your application inside a desktop device such as an iMac. | ||
|
||
<Example name="mockup.desktop" /> | ||
|
||
## Smartwatch mockup | ||
|
||
This component can be used to showcase applications built for smartwatches. | ||
|
||
<Example name="mockup.smartwatch" /> | ||
|
||
## Mockup colors | ||
|
||
You can easily update the color of the mockup by changing the background color with Tailwind CSS. | ||
|
||
<Example name="mockup.colors" /> | ||
|
||
## Theme | ||
|
||
To learn more about how to customize the appearance of components, please see the [Theme docs](/docs/customize/theme). | ||
|
||
### Default mockup theme | ||
|
||
<Theme name="mockup.default" /> | ||
|
||
### iPhone 12 mockup (iOS) theme | ||
|
||
<Theme name="mockup.iPhone12" /> | ||
|
||
### Google Pixel (Android) theme | ||
|
||
<Theme name="mockup.googlePixel" /> | ||
|
||
### Tablet mockup theme | ||
|
||
<Theme name="mockup.tablet" /> | ||
|
||
### Laptop mockup theme | ||
|
||
<Theme name="mockup.laptop" /> | ||
|
||
### Desktop mockup theme | ||
|
||
<Theme name="mockup.desktop" /> | ||
|
||
### Smartwatch mockup theme | ||
|
||
<Theme name="mockup.smartwatch" /> | ||
|
||
## References | ||
|
||
- [Flowbite Device Mockups](https://flowbite.com/docs/components/device-mockups/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export { colors } from "./mockup.colors"; | ||
export { desktop } from "./mockup.desktop"; | ||
export { googlePixel } from "./mockup.googlePixel"; | ||
export { iPhone12 } from "./mockup.iPhone12"; | ||
export { laptop } from "./mockup.laptop"; | ||
export { root } from "./mockup.root"; | ||
export { smartwatch } from "./mockup.smartwatch"; | ||
export { tablet } from "./mockup.tablet"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { DefaultMockup, getTheme } from "flowbite-react"; | ||
import { twMerge } from "tailwind-merge"; | ||
import { type CodeData } from "~/components/code-demo"; | ||
|
||
const code = ` | ||
"use client"; | ||
|
||
import { DefaultMockup, getTheme } from "flowbite-react"; | ||
import { twMerge } from "tailwind-merge"; | ||
|
||
export function Component() { | ||
return ( | ||
<DefaultMockup theme={{ root: twMerge(getTheme().mockup.default.root, "border-gray-300") }}> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/hero/mockup-1-light.png" | ||
className="h-[572px] w-[272px] dark:hidden" | ||
alt="" | ||
/> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/hero/mockup-1-dark.png" | ||
className="hidden h-[572px] w-[272px] dark:block" | ||
alt="" | ||
/> | ||
</DefaultMockup> | ||
); | ||
} | ||
`; | ||
|
||
const codeRSC = ` | ||
import { DefaultMockup, getTheme } from "flowbite-react"; | ||
import { twMerge } from "tailwind-merge"; | ||
|
||
export function Component() { | ||
return ( | ||
<DefaultMockup theme={{ root: twMerge(getTheme().mockup.default.root, "border-gray-300") }}> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/hero/mockup-1-light.png" | ||
className="h-[572px] w-[272px] dark:hidden" | ||
alt="" | ||
/> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/hero/mockup-1-dark.png" | ||
className="hidden h-[572px] w-[272px] dark:block" | ||
alt="" | ||
/> | ||
</DefaultMockup> | ||
); | ||
} | ||
`; | ||
|
||
export function Component() { | ||
return ( | ||
<DefaultMockup theme={{ root: twMerge(getTheme().mockup.default.root, "border-gray-300") }}> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/hero/mockup-1-light.png" | ||
className="h-[572px] w-[272px] dark:hidden" | ||
alt="" | ||
/> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/hero/mockup-1-dark.png" | ||
className="hidden h-[572px] w-[272px] dark:block" | ||
alt="" | ||
/> | ||
</DefaultMockup> | ||
); | ||
} | ||
|
||
export const colors: CodeData = { | ||
type: "single", | ||
code: [ | ||
{ | ||
fileName: "client", | ||
language: "tsx", | ||
code, | ||
}, | ||
{ | ||
fileName: "server", | ||
language: "tsx", | ||
code: codeRSC, | ||
}, | ||
], | ||
githubSlug: "mockup/mockup.colors.tsx", | ||
component: <Component />, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { DefaultMockup, DesktopMockup } from "flowbite-react"; | ||
import { type CodeData } from "~/components/code-demo"; | ||
|
||
const code = ` | ||
"use client"; | ||
|
||
import { DefaultMockup } from "flowbite-react"; | ||
|
||
export function Component() { | ||
return ( | ||
<DesktopMockup> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/docs/device-mockups/screen-image-imac.png" | ||
className="h-[140px] w-full rounded-xl md:h-[262px] dark:hidden" | ||
alt="" | ||
/> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/docs/device-mockups/screen-image-imac-dark.png" | ||
className="hidden h-[140px] w-full rounded-xl md:h-[262px] dark:block" | ||
alt="" | ||
/> | ||
</DesktopMockup> | ||
); | ||
} | ||
`; | ||
|
||
const codeRSC = ` | ||
import { DefaultMockup } from "flowbite-react"; | ||
|
||
export function Component() { | ||
return ( | ||
<DesktopMockup> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/docs/device-mockups/screen-image-imac.png" | ||
className="h-[140px] w-full rounded-xl md:h-[262px] dark:hidden" | ||
alt="" | ||
/> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/docs/device-mockups/screen-image-imac-dark.png" | ||
className="hidden h-[140px] w-full rounded-xl md:h-[262px] dark:block" | ||
alt="" | ||
/> | ||
</DesktopMockup> | ||
); | ||
} | ||
`; | ||
|
||
export function Component() { | ||
return ( | ||
<DesktopMockup> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/docs/device-mockups/screen-image-imac.png" | ||
className="h-[140px] w-full rounded-xl md:h-[262px] dark:hidden" | ||
alt="" | ||
/> | ||
<img | ||
src="https://flowbite.s3.amazonaws.com/docs/device-mockups/screen-image-imac-dark.png" | ||
className="hidden h-[140px] w-full rounded-xl md:h-[262px] dark:block" | ||
alt="" | ||
/> | ||
</DesktopMockup> | ||
); | ||
} | ||
|
||
export const desktop: CodeData = { | ||
type: "single", | ||
code: [ | ||
{ | ||
fileName: "client", | ||
language: "tsx", | ||
code, | ||
}, | ||
{ | ||
fileName: "server", | ||
language: "tsx", | ||
code: codeRSC, | ||
}, | ||
], | ||
githubSlug: "mockup/mockup.desktop.tsx", | ||
component: <Component />, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.