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: adding the android mockup #456

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions __registry__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ export const Index: Record<string, any> = {
subcategory: "undefined",
chunks: [],
},
android: {
name: "android",
type: "registry:ui",
registryDependencies: undefined,
files: ["registry/default/magicui/android.tsx"],
component: React.lazy(
() => import("@/registry/default/magicui/android.tsx"),
),
source: "",
category: "undefined",
subcategory: "undefined",
chunks: [],
},
"morphing-text": {
name: "morphing-text",
type: "registry:ui",
Expand Down Expand Up @@ -789,6 +802,45 @@ export const Index: Record<string, any> = {
subcategory: "undefined",
chunks: [],
},
"android-demo": {
name: "android-demo",
type: "registry:example",
registryDependencies: ["android"],
files: ["registry/default/example/android-demo.tsx"],
component: React.lazy(
() => import("@/registry/default/example/android-demo.tsx"),
),
source: "",
category: "undefined",
subcategory: "undefined",
chunks: [],
},
"android-demo-2": {
name: "android-demo-2",
type: "registry:example",
registryDependencies: ["android"],
files: ["registry/default/example/android-demo-2.tsx"],
component: React.lazy(
() => import("@/registry/default/example/android-demo-2.tsx"),
),
source: "",
category: "undefined",
subcategory: "undefined",
chunks: [],
},
"android-demo-3": {
name: "android-demo-3",
type: "registry:example",
registryDependencies: ["android"],
files: ["registry/default/example/android-demo-3.tsx"],
component: React.lazy(
() => import("@/registry/default/example/android-demo-3.tsx"),
),
source: "",
category: "undefined",
subcategory: "undefined",
chunks: [],
},
"morphing-text-demo": {
name: "morphing-text-demo",
type: "registry:example",
Expand Down
6 changes: 6 additions & 0 deletions config/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ export const docsConfig: DocsConfig = {
items: [],
label: "",
},
{
title: "Android",
href: `/docs/components/android`,
items: [],
label: "",
},
],
},
{
Expand Down
60 changes: 60 additions & 0 deletions content/docs/components/android.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: Android
date: 2024-12-20
description: A mockup of the Android
author: dillionverma
published: true
---

<ComponentPreview name="android-demo" />

## Installation

<Tabs defaultValue="cli">

<TabsList>
<TabsTrigger value="cli">CLI</TabsTrigger>
<TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>
<TabsContent value="cli">

```bash
npx shadcn@latest add "https://magicui.design/r/android"
```

</TabsContent>

<TabsContent value="manual">

<Steps>

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource name="android" />

</Steps>

</TabsContent>

</Tabs>

## Examples

### With Image

<ComponentPreview name="android-demo-2" />

### With Video

<ComponentPreview name="android-demo-3" />

## Props

| Prop | Type | Description | Default |
| -------- | ------ | ---------------------------------- | ------- |
| width | number | The width of the Android window | 433 |
| height | number | The height of the Android window | 882 |
| src | string | The source of the image to display | |
| videoSrc | string | The source of the video to display | |

The `Android` component also accepts all properties of the `SVGElement` type.
10 changes: 10 additions & 0 deletions public/r/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
}
]
},
{
"name": "android",
"type": "registry:ui",
"files": [
{
"path": "magicui/android.tsx",
"type": "registry:ui"
}
]
},
{
"name": "morphing-text",
"type": "registry:ui",
Expand Down
12 changes: 12 additions & 0 deletions public/r/styles/default/android.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "android",
"type": "registry:ui",
"files": [
{
"path": "magicui/android.tsx",
"content": "import { SVGProps } from \"react\";\n\nexport interface AndroidProps extends SVGProps<SVGSVGElement> {\n width?: number;\n height?: number;\n src?: string;\n videoSrc?: string;\n}\n\nexport default function Android({\n width = 433,\n height = 882,\n src,\n videoSrc,\n ...props\n}: AndroidProps) {\n return (\n <svg\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n d=\"M376 153H378C379.105 153 380 153.895 380 155V249C380 250.105 379.105 251 378 251H376V153Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M376 301H378C379.105 301 380 301.895 380 303V351C380 352.105 379.105 353 378 353H376V301Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M0 42C0 18.8041 18.804 0 42 0H336C359.196 0 378 18.804 378 42V788C378 811.196 359.196 830 336 830H42C18.804 830 0 811.196 0 788V42Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M2 43C2 22.0132 19.0132 5 40 5H338C358.987 5 376 22.0132 376 43V787C376 807.987 358.987 825 338 825H40C19.0132 825 2 807.987 2 787V43Z\"\n className=\"fill-white dark:fill-[#262626]\"\n />\n\n <g clip-path=\"url(#clip0_514_20855)\">\n <path\n d=\"M9.25 48C9.25 29.3604 24.3604 14.25 43 14.25H335C353.64 14.25 368.75 29.3604 368.75 48V780C368.75 798.64 353.64 813.75 335 813.75H43C24.3604 813.75 9.25 798.64 9.25 780V48Z\"\n className=\"fill-[#E5E5E5] stroke-[#E5E5E5] stroke-[0.5] dark:fill-[#404040] dark:stroke-[#404040]\"\n />\n </g>\n <circle\n cx=\"189\"\n cy=\"28\"\n r=\"9\"\n className=\"fill-white dark:fill-[#262626]\"\n />\n <circle\n cx=\"189\"\n cy=\"28\"\n r=\"4\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n {src && (\n <image\n href={src}\n width=\"360\"\n height=\"800\"\n className=\"size-full object-cover\"\n preserveAspectRatio=\"xMidYMid slice\"\n clipPath=\"url(#clip0_514_20855)\"\n />\n )}\n {videoSrc && (\n <foreignObject\n width=\"380\"\n height=\"820\"\n clipPath=\"url(#clip0_514_20855)\"\n preserveAspectRatio=\"xMidYMid slice\"\n >\n <video\n className=\"size-full object-cover\"\n src={videoSrc}\n autoPlay\n loop\n muted\n playsInline\n />\n </foreignObject>\n )}\n <defs>\n <clipPath id=\"clip0_514_20855\">\n <rect\n width=\"360\"\n height=\"800\"\n rx=\"33\"\n ry=\"25\"\n className=\"fill-white dark:fill-[#262626]\"\n transform=\"translate(9 14)\"\n />\n </clipPath>\n </defs>\n </svg>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
]
}
12 changes: 12 additions & 0 deletions registry/default/example/android-demo-2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Android from "@/registry/default/magicui/android";

export default function AndroidDemo() {
return (
<div className="relative">
<Android
className="size-full"
src="https://images.unsplash.com/photo-1730326405863-c6fa7e499a6e?q=80&w=1964&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
/>
</div>
);
}
12 changes: 12 additions & 0 deletions registry/default/example/android-demo-3.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Android from "@/registry/default/magicui/android";

export default function AndroidDemo() {
return (
<div className="relative">
<Android
className="size-full"
videoSrc="https://videos.pexels.com/video-files/14993748/14993748-uhd_1296_2304_30fps.mp4"
/>
</div>
);
}
9 changes: 9 additions & 0 deletions registry/default/example/android-demo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Android from "@/registry/default/magicui/android";

export default function AndroidDemo() {
return (
<div className="relative">
<Android className="size-full" />
</div>
);
}
102 changes: 102 additions & 0 deletions registry/default/magicui/android.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import { SVGProps } from "react";

export interface AndroidProps extends SVGProps<SVGSVGElement> {
width?: number;
height?: number;
src?: string;
videoSrc?: string;
}

export default function Android({
width = 433,
height = 882,
src,
videoSrc,
...props
}: AndroidProps) {
return (
<svg
width={width}
height={height}
viewBox={`0 0 ${width} ${height}`}
fill="none"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
d="M376 153H378C379.105 153 380 153.895 380 155V249C380 250.105 379.105 251 378 251H376V153Z"
className="fill-[#E5E5E5] dark:fill-[#404040]"
/>
<path
d="M376 301H378C379.105 301 380 301.895 380 303V351C380 352.105 379.105 353 378 353H376V301Z"
className="fill-[#E5E5E5] dark:fill-[#404040]"
/>
<path
d="M0 42C0 18.8041 18.804 0 42 0H336C359.196 0 378 18.804 378 42V788C378 811.196 359.196 830 336 830H42C18.804 830 0 811.196 0 788V42Z"
className="fill-[#E5E5E5] dark:fill-[#404040]"
/>
<path
d="M2 43C2 22.0132 19.0132 5 40 5H338C358.987 5 376 22.0132 376 43V787C376 807.987 358.987 825 338 825H40C19.0132 825 2 807.987 2 787V43Z"
className="fill-white dark:fill-[#262626]"
/>

<g clip-path="url(#clip0_514_20855)">
<path
d="M9.25 48C9.25 29.3604 24.3604 14.25 43 14.25H335C353.64 14.25 368.75 29.3604 368.75 48V780C368.75 798.64 353.64 813.75 335 813.75H43C24.3604 813.75 9.25 798.64 9.25 780V48Z"
className="fill-[#E5E5E5] stroke-[#E5E5E5] stroke-[0.5] dark:fill-[#404040] dark:stroke-[#404040]"
/>
</g>
<circle
cx="189"
cy="28"
r="9"
className="fill-white dark:fill-[#262626]"
/>
<circle
cx="189"
cy="28"
r="4"
className="fill-[#E5E5E5] dark:fill-[#404040]"
/>
{src && (
<image
href={src}
width="360"
height="800"
className="size-full object-cover"
preserveAspectRatio="xMidYMid slice"
clipPath="url(#clip0_514_20855)"
/>
)}
{videoSrc && (
<foreignObject
width="380"
height="820"
clipPath="url(#clip0_514_20855)"
preserveAspectRatio="xMidYMid slice"
>
<video
className="size-full object-cover"
src={videoSrc}
autoPlay
loop
muted
playsInline
/>
</foreignObject>
)}
<defs>
<clipPath id="clip0_514_20855">
<rect
width="360"
height="800"
rx="33"
ry="25"
className="fill-white dark:fill-[#262626]"
transform="translate(9 14)"
/>
</clipPath>
</defs>
</svg>
);
}
18 changes: 18 additions & 0 deletions registry/registry-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ export const examples: Registry = [
registryDependencies: ["magic-card"],
files: ["example/magic-card-demo.tsx"],
},
{
name: "android-demo",
type: "registry:example",
registryDependencies: ["android"],
files: ["example/android-demo.tsx"],
},
{
name: "android-demo-2",
type: "registry:example",
registryDependencies: ["android"],
files: ["example/android-demo-2.tsx"],
},
{
name: "android-demo-3",
type: "registry:example",
registryDependencies: ["android"],
files: ["example/android-demo-3.tsx"],
},
{
name: "morphing-text-demo",
type: "registry:example",
Expand Down
5 changes: 5 additions & 0 deletions registry/registry-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export const ui: Registry = [
dependencies: ["framer-motion"],
files: ["magicui/magic-card.tsx"],
},
{
name: "android",
type: "registry:ui",
files: ["magicui/android.tsx"],
},
{
name: "morphing-text",
type: "registry:ui",
Expand Down
Loading