UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
Add video support to iPhone 15 Pro component (#323)
xAstralMars5e5eefbeab40
diff --git a/__registry__/index.tsx b/__registry__/index.tsxindex a408e40a..61d260c9 100644--- a/__registry__/index.tsx+++ b/__registry__/index.tsx@@ -1878,6 +1878,19 @@ export const Index: Record<string, any> = {subcategory: "undefined",chunks: [],},+ "iphone-15-pro-demo-3": {+ name: "iphone-15-pro-demo-3",+ type: "registry:example",+ registryDependencies: undefined,+ files: ["registry/default/example/iphone-15-pro-demo-3.tsx"],+ component: React.lazy(+ () => import("@/registry/default/example/iphone-15-pro-demo-3.tsx"),+ ),+ source: "",+ category: "undefined",+ subcategory: "undefined",+ chunks: [],+ },"rainbow-button-demo": {name: "rainbow-button-demo",type: "registry:example",diff --git a/content/docs/components/iphone-15-pro.mdx b/content/docs/components/iphone-15-pro.mdxindex 5cb5f79a..e3a3245d 100644--- a/content/docs/components/iphone-15-pro.mdx+++ b/content/docs/components/iphone-15-pro.mdx@@ -1,6 +1,6 @@---title: iPhone 15 Pro-date: 2024-09-01+date: 2024-12-17description: A mockup of the iPhone 15 Proauthor: dillionvermapublished: true@@ -46,12 +46,17 @@ npx shadcn@latest add "https://magicui.design/r/iphone-15-pro"<ComponentPreview name="iphone-15-pro-demo-2" />+### With Video++<ComponentPreview name="iphone-15-pro-demo-3" />+## Props-| Prop | Type | Description | Default |-| ------ | ------ | -------------------------------------- | ------- |-| width | number | The width of the iPhone 15 Pro window | 433 |-| height | number | The height of the iPhone 15 Pro window | 882 |-| src | string | The source of the image to display | |+| Prop | Type | Description | Default |+| -------- | ------ | -------------------------------------- | ------- |+| width | number | The width of the iPhone 15 Pro window | 433 |+| height | number | The height of the iPhone 15 Pro window | 882 |+| src | string | The source of the image to display | |+| videoSrc | string | The source of the video to display | |The `Iphone15Pro` component also accepts all properties of the `SVGElement` type.diff --git a/public/r/styles/default/interactive-hover-button.json b/public/r/styles/default/interactive-hover-button.jsonindex f3495fc6..b0ebf488 100644--- a/public/r/styles/default/interactive-hover-button.json+++ b/public/r/styles/default/interactive-hover-button.json@@ -7,7 +7,7 @@"files": [{"path": "magicui/interactive-hover-button.tsx",- "content": "import React from \"react\";\nimport { ArrowRight } from \"lucide-react\";\n\ninterface InteractiveHoverButtonProps {\n text?: string;\n className?: string;\n}\n\nexport default function InteractiveHoverButton({\n text = \"Button\",\n className,\n}: InteractiveHoverButtonProps = {}) {\n return (\n <div\n className={`group relative w-32 cursor-pointer overflow-hidden rounded-full border bg-white p-2 text-center font-semibold text-black ${className}`}\n >\n <span className=\"inline-block translate-x-1 transition-all duration-300 group-hover:translate-x-12 group-hover:opacity-0\">\n {text}\n </span>\n <div className=\"absolute top-0 z-10 flex h-full w-full translate-x-12 items-center justify-center gap-2 text-white opacity-0 transition-all duration-300 group-hover:-translate-x-1 group-hover:opacity-100\">\n <span>{text}</span>\n <ArrowRight />\n </div>\n <div className=\"absolute left-[20%] top-[40%] h-2 w-2 scale-[1] rounded-lg bg-black transition-all duration-300 group-hover:left-[0%] group-hover:top-[0%] group-hover:h-full group-hover:w-full group-hover:scale-[1.8] group-hover:bg-[#263381] dark:group-hover:bg-[#7e85ee]\"></div>\n </div>\n );\n}\n",+ "content": "import React from \"react\";\nimport { ArrowRight } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\ninterface InteractiveHoverButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n text?: string;\n}\n\nconst InteractiveHoverButton = React.forwardRef<\n HTMLButtonElement,\n InteractiveHoverButtonProps\n>(({ text = \"Button\", className, ...props }, ref) => {\n return (\n <button\n ref={ref}\n className={cn(\n \"group relative w-32 cursor-pointer overflow-hidden rounded-full border bg-background p-2 text-center font-semibold\",\n className,\n )}\n {...props}\n >\n <span className=\"inline-block translate-x-1 transition-all duration-300 group-hover:translate-x-12 group-hover:opacity-0\">\n {text}\n </span>\n <div className=\"absolute top-0 z-10 flex h-full w-full translate-x-12 items-center justify-center gap-2 text-primary-foreground opacity-0 transition-all duration-300 group-hover:-translate-x-1 group-hover:opacity-100\">\n <span>{text}</span>\n <ArrowRight />\n </div>\n <div className=\"absolute left-[20%] top-[40%] h-2 w-2 scale-[1] rounded-lg bg-primary transition-all duration-300 group-hover:left-[0%] group-hover:top-[0%] group-hover:h-full group-hover:w-full group-hover:scale-[1.8] group-hover:bg-primary\"></div>\n </button>\n );\n});\n\nInteractiveHoverButton.displayName = \"InteractiveHoverButton\";\n\nexport default InteractiveHoverButton;\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/iphone-15-pro.json b/public/r/styles/default/iphone-15-pro.jsonindex a68bd545..1faac521 100644--- a/public/r/styles/default/iphone-15-pro.json+++ b/public/r/styles/default/iphone-15-pro.json@@ -4,7 +4,7 @@"files": [{"path": "magicui/iphone-15-pro.tsx",- "content": "import { SVGProps } from \"react\";\n\nexport interface Iphone15ProProps extends SVGProps<SVGSVGElement> {\n width?: number;\n height?: number;\n src?: string;\n}\n\nexport default function Iphone15Pro({\n width = 433,\n height = 882,\n src,\n ...props\n}: Iphone15ProProps) {\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=\"M2 73C2 32.6832 34.6832 0 75 0H357C397.317 0 430 32.6832 430 73V809C430 849.317 397.317 882 357 882H75C34.6832 882 2 849.317 2 809V73Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M0 171C0 170.448 0.447715 170 1 170H3V204H1C0.447715 204 0 203.552 0 203V171Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M1 234C1 233.448 1.44772 233 2 233H3.5V300H2C1.44772 300 1 299.552 1 299V234Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M1 319C1 318.448 1.44772 318 2 318H3.5V385H2C1.44772 385 1 384.552 1 384V319Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M430 279H432C432.552 279 433 279.448 433 280V384C433 384.552 432.552 385 432 385H430V279Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M6 74C6 35.3401 37.3401 4 76 4H356C394.66 4 426 35.3401 426 74V808C426 846.66 394.66 878 356 878H76C37.3401 878 6 846.66 6 808V74Z\"\n className=\"dark:fill-[#262626] fill-white\"\n />\n <path\n opacity=\"0.5\"\n d=\"M174 5H258V5.5C258 6.60457 257.105 7.5 256 7.5H176C174.895 7.5 174 6.60457 174 5.5V5Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M21.25 75C21.25 44.2101 46.2101 19.25 77 19.25H355C385.79 19.25 410.75 44.2101 410.75 75V807C410.75 837.79 385.79 862.75 355 862.75H77C46.2101 862.75 21.25 837.79 21.25 807V75Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040] stroke-[#E5E5E5] dark:stroke-[#404040] stroke-[0.5]\"\n />\n\n {src && (\n <image\n href={src}\n x=\"21.25\"\n y=\"19.25\"\n width=\"389.5\"\n height=\"843.5\"\n preserveAspectRatio=\"xMidYMid slice\"\n clipPath=\"url(#roundedCorners)\"\n />\n )}\n <path\n d=\"M154 48.5C154 38.2827 162.283 30 172.5 30H259.5C269.717 30 278 38.2827 278 48.5C278 58.7173 269.717 67 259.5 67H172.5C162.283 67 154 58.7173 154 48.5Z\"\n className=\"dark:fill-[#262626] fill-[#F5F5F5]\"\n />\n <path\n d=\"M249 48.5C249 42.701 253.701 38 259.5 38C265.299 38 270 42.701 270 48.5C270 54.299 265.299 59 259.5 59C253.701 59 249 54.299 249 48.5Z\"\n className=\"dark:fill-[#262626] fill-[#F5F5F5]\"\n />\n <path\n d=\"M254 48.5C254 45.4624 256.462 43 259.5 43C262.538 43 265 45.4624 265 48.5C265 51.5376 262.538 54 259.5 54C256.462 54 254 51.5376 254 48.5Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <defs>\n <clipPath id=\"roundedCorners\">\n <rect\n x=\"21.25\"\n y=\"19.25\"\n width=\"389.5\"\n height=\"843.5\"\n rx=\"55.75\"\n ry=\"55.75\"\n />\n </clipPath>\n </defs>\n </svg>\n );\n}\n",+ "content": "import { SVGProps } from \"react\";\n\nexport interface Iphone15ProProps extends SVGProps<SVGSVGElement> {\n width?: number;\n height?: number;\n src?: string;\n videoSrc?: string;\n}\n\nexport default function Iphone15Pro({\n width = 433,\n height = 882,\n src,\n videoSrc,\n ...props\n}: Iphone15ProProps) {\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=\"M2 73C2 32.6832 34.6832 0 75 0H357C397.317 0 430 32.6832 430 73V809C430 849.317 397.317 882 357 882H75C34.6832 882 2 849.317 2 809V73Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M0 171C0 170.448 0.447715 170 1 170H3V204H1C0.447715 204 0 203.552 0 203V171Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M1 234C1 233.448 1.44772 233 2 233H3.5V300H2C1.44772 300 1 299.552 1 299V234Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M1 319C1 318.448 1.44772 318 2 318H3.5V385H2C1.44772 385 1 384.552 1 384V319Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M430 279H432C432.552 279 433 279.448 433 280V384C433 384.552 432.552 385 432 385H430V279Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M6 74C6 35.3401 37.3401 4 76 4H356C394.66 4 426 35.3401 426 74V808C426 846.66 394.66 878 356 878H76C37.3401 878 6 846.66 6 808V74Z\"\n className=\"fill-white dark:fill-[#262626]\"\n />\n <path\n opacity=\"0.5\"\n d=\"M174 5H258V5.5C258 6.60457 257.105 7.5 256 7.5H176C174.895 7.5 174 6.60457 174 5.5V5Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <path\n d=\"M21.25 75C21.25 44.2101 46.2101 19.25 77 19.25H355C385.79 19.25 410.75 44.2101 410.75 75V807C410.75 837.79 385.79 862.75 355 862.75H77C46.2101 862.75 21.25 837.79 21.25 807V75Z\"\n className=\"fill-[#E5E5E5] stroke-[#E5E5E5] stroke-[0.5] dark:fill-[#404040] dark:stroke-[#404040]\"\n />\n\n {src && (\n <image\n href={src}\n x=\"21.25\"\n y=\"19.25\"\n width=\"389.5\"\n height=\"843.5\"\n preserveAspectRatio=\"xMidYMid slice\"\n clipPath=\"url(#roundedCorners)\"\n />\n )}\n {videoSrc && (\n <foreignObject x=\"21.25\" y=\"19.25\" width=\"389.5\" height=\"843.5\">\n <video\n className=\"size-full overflow-hidden rounded-[55.75px] object-cover\"\n src={videoSrc}\n autoPlay\n loop\n muted\n playsInline\n />\n </foreignObject>\n )}\n <path\n d=\"M154 48.5C154 38.2827 162.283 30 172.5 30H259.5C269.717 30 278 38.2827 278 48.5C278 58.7173 269.717 67 259.5 67H172.5C162.283 67 154 58.7173 154 48.5Z\"\n className=\"fill-[#F5F5F5] dark:fill-[#262626]\"\n />\n <path\n d=\"M249 48.5C249 42.701 253.701 38 259.5 38C265.299 38 270 42.701 270 48.5C270 54.299 265.299 59 259.5 59C253.701 59 249 54.299 249 48.5Z\"\n className=\"fill-[#F5F5F5] dark:fill-[#262626]\"\n />\n <path\n d=\"M254 48.5C254 45.4624 256.462 43 259.5 43C262.538 43 265 45.4624 265 48.5C265 51.5376 262.538 54 259.5 54C256.462 54 254 51.5376 254 48.5Z\"\n className=\"fill-[#E5E5E5] dark:fill-[#404040]\"\n />\n <defs>\n <clipPath id=\"roundedCorners\">\n <rect\n x=\"21.25\"\n y=\"19.25\"\n width=\"389.5\"\n height=\"843.5\"\n rx=\"55.75\"\n ry=\"55.75\"\n />\n </clipPath>\n </defs>\n </svg>\n );\n}\n","type": "registry:ui","target": ""}diff --git a/registry/default/example/iphone-15-pro-demo-3.tsx b/registry/default/example/iphone-15-pro-demo-3.tsxnew file mode 100644index 00000000..e706fe7e--- /dev/null+++ b/registry/default/example/iphone-15-pro-demo-3.tsx@@ -0,0 +1,12 @@+import Iphone15Pro from "@/registry/default/magicui/iphone-15-pro";++export default function Iphone15ProDemo() {+ return (+ <div className="relative">+ <Iphone15Pro+ className="size-full"+ videoSrc="https://videos.pexels.com/video-files/8946986/8946986-uhd_1440_2732_25fps.mp4"+ />+ </div>+ );+}diff --git a/registry/default/magicui/iphone-15-pro.tsx b/registry/default/magicui/iphone-15-pro.tsxindex a16aef00..a552215c 100644--- a/registry/default/magicui/iphone-15-pro.tsx+++ b/registry/default/magicui/iphone-15-pro.tsx@@ -4,12 +4,14 @@ export interface Iphone15ProProps extends SVGProps<SVGSVGElement> {width?: number;height?: number;src?: string;+ videoSrc?: string;}export default function Iphone15Pro({width = 433,height = 882,src,+ videoSrc,...props}: Iphone15ProProps) {return (@@ -43,7 +45,7 @@ export default function Iphone15Pro({/><pathd="M6 74C6 35.3401 37.3401 4 76 4H356C394.66 4 426 35.3401 426 74V808C426 846.66 394.66 878 356 878H76C37.3401 878 6 846.66 6 808V74Z"- className="dark:fill-[#262626] fill-white"+ className="fill-white dark:fill-[#262626]"/><pathopacity="0.5"@@ -52,7 +54,7 @@ export default function Iphone15Pro({/><pathd="M21.25 75C21.25 44.2101 46.2101 19.25 77 19.25H355C385.79 19.25 410.75 44.2101 410.75 75V807C410.75 837.79 385.79 862.75 355 862.75H77C46.2101 862.75 21.25 837.79 21.25 807V75Z"- className="fill-[#E5E5E5] dark:fill-[#404040] stroke-[#E5E5E5] dark:stroke-[#404040] stroke-[0.5]"+ className="fill-[#E5E5E5] stroke-[#E5E5E5] stroke-[0.5] dark:fill-[#404040] dark:stroke-[#404040]"/>{src && (@@ -66,13 +68,25 @@ export default function Iphone15Pro({clipPath="url(#roundedCorners)"/>)}+ {videoSrc && (+ <foreignObject x="21.25" y="19.25" width="389.5" height="843.5">+ <video+ className="size-full overflow-hidden rounded-[55.75px] object-cover"+ src={videoSrc}+ autoPlay+ loop+ muted+ playsInline+ />+ </foreignObject>+ )}<pathd="M154 48.5C154 38.2827 162.283 30 172.5 30H259.5C269.717 30 278 38.2827 278 48.5C278 58.7173 269.717 67 259.5 67H172.5C162.283 67 154 58.7173 154 48.5Z"- className="dark:fill-[#262626] fill-[#F5F5F5]"+ className="fill-[#F5F5F5] dark:fill-[#262626]"/><pathd="M249 48.5C249 42.701 253.701 38 259.5 38C265.299 38 270 42.701 270 48.5C270 54.299 265.299 59 259.5 59C253.701 59 249 54.299 249 48.5Z"- className="dark:fill-[#262626] fill-[#F5F5F5]"+ className="fill-[#F5F5F5] dark:fill-[#262626]"/><pathd="M254 48.5C254 45.4624 256.462 43 259.5 43C262.538 43 265 45.4624 265 48.5C265 51.5376 262.538 54 259.5 54C256.462 54 254 51.5376 254 48.5Z"diff --git a/registry/registry-examples.ts b/registry/registry-examples.tsindex 3847f425..a837ce31 100644--- a/registry/registry-examples.ts+++ b/registry/registry-examples.ts@@ -483,6 +483,11 @@ export const examples: Registry = [type: "registry:example",files: ["example/iphone-15-pro-demo-2.tsx"],},+ {+ name: "iphone-15-pro-demo-3",+ type: "registry:example",+ files: ["example/iphone-15-pro-demo-3.tsx"],+ },{name: "rainbow-button-demo",type: "registry:example",