-
-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components): add "Device Mockups"
- Loading branch information
1 parent
b2640bc
commit dcfbb1c
Showing
26 changed files
with
1,204 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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.