Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

feat(ui): enhance SidebarTool component with badgeCount prop and display logic

CristianOlivera191e36550188c
diff --git a/app/components/ui/DemoVideo.tsx b/app/components/ui/DemoVideo.tsx
index a1db13d..ec948d4 100644
--- a/app/components/ui/DemoVideo.tsx
+++ b/app/components/ui/DemoVideo.tsx
@@ -1,7 +1,7 @@
"use client";
import React, { useEffect, useRef, useState } from "react";
-import { AnimatePresence, motion, Variants } from "framer-motion";
+import { AnimatePresence, motion } from "framer-motion";
const features = [
"Grabación de pantalla",
@@ -46,37 +46,6 @@ export default function DemoVideo() {
};
}, []);
- const tickerVariants: Variants = {
- enter: {
- y: 20,
- opacity: 0,
- filter: "blur(4px)",
- scale: 0.95
- },
- center: {
- y: 0,
- opacity: 1,
- filter: "blur(0px)",
- scale: 1,
- transition: {
- y: { type: "spring", stiffness: 300, damping: 30 },
- opacity: { duration: 0.2 },
- filter: { duration: 0.3 }
- }
- },
- exit: {
- y: -20,
- opacity: 0,
- filter: "blur(4px)",
- scale: 0.95,
- transition: {
- y: { type: "spring", stiffness: 300, damping: 30 },
- opacity: { duration: 0.2 },
- filter: { duration: 0.3 }
- }
- }
- };
-
return (
<div className="w-full flex flex-col items-center mb-30">
<h2 className="text-4xl md:text-6xl text-center font-bold tracking-tighter text-white mb-10 leading-tight drop-shadow-[1.2px_1.2px_100.2px_rgba(183,203,248,1)]">
diff --git a/app/components/ui/PhotoPickerPopover.tsx b/app/components/ui/PhotoPickerPopover.tsx
index 73e4279..209c1e0 100644
--- a/app/components/ui/PhotoPickerPopover.tsx
+++ b/app/components/ui/PhotoPickerPopover.tsx
@@ -290,7 +290,7 @@ export function PhotoPickerPopover({ onSelect }: PhotoPickerPopoverProps) {
</div>
<div className="px-4 py-2.5 border-t border-white/10 bg-white/5 shrink-0">
- <span className="text-[9px] text-white/30">
+ <span className="text-[10px] text-white/30">
Fotos de{" "}
<a
href="https://unsplash.com"
diff --git a/app/components/ui/PlaceholderEditor.tsx b/app/components/ui/PlaceholderEditor.tsx
index 7630dcb..54546c5 100644
--- a/app/components/ui/PlaceholderEditor.tsx
+++ b/app/components/ui/PlaceholderEditor.tsx
@@ -23,7 +23,6 @@ export default function PlaceholderEditor({ onVideoUpload, isUploading = false }
fileInputRef.current?.click();
};
- // --- Funciones del Drag & Drop ---
const handleDragEnter = (e: React.DragEvent<HTMLDivElement>) => {
e.preventDefault();
e.stopPropagation();
@@ -38,7 +37,7 @@ export default function PlaceholderEditor({ onVideoUpload, isUploading = false }
const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {
e.preventDefault();
- e.stopPropagation(); // Previene que el navegador abra el archivo
+ e.stopPropagation();
};
const handleDrop = (e: React.DragEvent<HTMLDivElement>) => {
diff --git a/app/components/ui/SidebarTool.tsx b/app/components/ui/SidebarTool.tsx
index 92bb67d..adb8822 100644
--- a/app/components/ui/SidebarTool.tsx
+++ b/app/components/ui/SidebarTool.tsx
@@ -9,11 +9,12 @@ interface SidebarToolProps {
isActive?: boolean;
onClick?: () => void;
badge?: string;
+ badgeCount?: number;
disabled?: boolean;
}
export const SidebarTool = forwardRef<HTMLButtonElement, SidebarToolProps>(
- ({ icon, label, isActive, onClick, badge, disabled }, ref) => {
+ ({ icon, label, isActive, onClick, badge, badgeCount, disabled }, ref) => {
return (
<button
ref={ref}
@@ -24,6 +25,14 @@ export const SidebarTool = forwardRef<HTMLButtonElement, SidebarToolProps>(
${isActive ? "text-white" : "text-white/60 hover:text-white"}`
}
>
+ {badgeCount !== undefined && badgeCount > 0 && (
+ <div className="absolute -top-1 right-1 z-10 min-w-4 h-4 px-1 flex items-center justify-center bg-emerald-500 rounded-full border border-emerald-400 shadow-lg pointer-events-none animate-in zoom-in-50 duration-200">
+ <span className="text-[9px] font-bold text-white leading-none">
+ {badgeCount > 9 ? "9+" : badgeCount}
+ </span>
+ </div>
+ )}
+
{badge && (
<div className="absolute -top-1 -right-0.5 z-10 px-1.5 py-0.5 bg-linear-to-r from-gray-500 to-gray-500 rounded-full border border-white/20 shadow-lg pointer-events-none">
<span className="text-[8px] font-bold text-white tracking-widest uppercase block drop-shadow-sm leading-none">