Skip to content

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

feat: update slider styles and improve performance in SliderControl component; enhance UI elements in ZoomFragmentEditor and PhotoEditorPlaceholder components; update wallpaper category count

CristianOlivera1bc896ccaff86
diff --git a/app/components/ui/BackgroundColorEditor.tsx b/app/components/ui/BackgroundColorEditor.tsx
index 03cc1d3..825c1b4 100644
--- a/app/components/ui/BackgroundColorEditor.tsx
+++ b/app/components/ui/BackgroundColorEditor.tsx
@@ -182,7 +182,7 @@ function SortableStopList({ stops, onReorder, onColorChange, onPositionChange, o
</div>
<div className="flex-1 min-w-0 space-y-0.5">
<div className="text-[9px] font-mono text-white/35 uppercase">{stop.color}</div>
- <input type="range" min="0" max="100" value={stop.position} onChange={(e) => onPositionChange(index, parseInt(e.target.value))} className="w-full h-1 bg-white/10 rounded-full appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-2 [&::-webkit-slider-thumb]:h-2 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-white/70" />
+ <input type="range" min="0" max="100" value={stop.position} onChange={(e) => onPositionChange(index, parseInt(e.target.value))} className="w-full h-1.5 bg-white/10 rounded-full appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-white/70" />
</div>
<div className="text-[9px] font-mono text-white/35 w-7 text-right flex-shrink-0">{stop.position}%</div>
{stops.length > 2 && (
@@ -463,7 +463,7 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor
type="range" min="0" max="360"
value={currentGradient.angle ?? (currentGradient.type === "conic" ? 0 : 135)}
onChange={(e) => onChange({ type: "gradient", config: { ...currentGradient, angle: parseInt(e.target.value) } })}
- className="w-full h-1.5 bg-white/10 rounded-full appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[linear-gradient(90deg,#00A3EE,#003780)]"
+ className="w-full h-1.5 bg-white/10 rounded-full appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-white/70"
aria-label={`${t("sections.angle")}: ${currentGradient.angle ?? (currentGradient.type === "conic" ? 0 : 135)} degrees`}
/>
</div>
@@ -486,7 +486,7 @@ export function BackgroundColorEditor({ value, onChange }: BackgroundColorEditor
<input
type="range" min="0" max="100" value={val}
onChange={(e) => onChange({ type: "gradient", config: { ...currentGradient, [key]: parseInt(e.target.value) } })}
- className="w-full h-1.5 bg-white/10 rounded-full appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[linear-gradient(90deg,#00A3EE,#003780)]"
+ className="w-full h-1.5 bg-white/10 rounded-full appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-white/70"
aria-label={`${t(`sections.origin${axis}`)}: ${val} percent`}
/>
</div>
diff --git a/app/components/ui/editor/PhotoEditorPlaceholder.tsx b/app/components/ui/editor/PhotoEditorPlaceholder.tsx
index 5f58b31..03b1a5c 100644
--- a/app/components/ui/editor/PhotoEditorPlaceholder.tsx
+++ b/app/components/ui/editor/PhotoEditorPlaceholder.tsx
@@ -426,14 +426,16 @@ export function PhotoEditorPlaceholder({
<div className="h-full w-px bg-white/5 absolute" />
</div>
<div
- className={`absolute w-2.5 h-2.5 rounded-full bg-cyan-500 shadow-[0_0_10px_rgba(0,163,255,0.5)]`}
+ className="absolute bg-white border border-white/40 rounded-full shadow-[0_0_20px_4px_rgba(255,255,255,0.12),0_4px_12px_rgba(0,0,0,0.6)] mix-blend-screen flex items-center justify-center pointer-events-auto transition-all duration-75 cursor-grab"
style={{
+ width: "14px",
+ height: "14px",
left: `${50 + (-customConfig.rotateY / 45) * 50}%`,
top: `${50 + (customConfig.rotateX / 45) * 50}%`,
- transform: "translate(-50%, -50%)",
- transition: "all 0.1s ease-out"
+ transform: "translate(-50%, -50%) scale(1)"
}}
/>
+
</div>
</div>
@@ -530,8 +532,8 @@ export function PhotoEditorPlaceholder({
size="sm"
onClick={() => onToggle3DBackground(!apply3DToBackground)}
className={`px-2.5 py-2 text-xs font-medium squircle-element transition-all ${apply3DToBackground
- ? "bg-gradient-radial-primary text-cyan-500 border border-cyan-500/50!"
- : "bg-white/5 text-white/50 border border-white/10 hover:bg-white/10"
+ ? "bg-gradient-radial-primary text-cyan-500 border border-cyan-500/50!"
+ : "bg-white/5 text-white/50 border border-white/10 hover:bg-white/10"
}`}
aria-label={t("photoPreview.apply3D")}
aria-pressed={apply3DToBackground}
diff --git a/app/components/ui/editor/ZoomFragmentEditor.tsx b/app/components/ui/editor/ZoomFragmentEditor.tsx
index 2cc33d8..594ebf1 100644
--- a/app/components/ui/editor/ZoomFragmentEditor.tsx
+++ b/app/components/ui/editor/ZoomFragmentEditor.tsx
@@ -182,7 +182,7 @@ export function ZoomFragmentEditor({
</div>
{/* Camera movement */}
- <div className="space-y-3 p-3 bg-white/3 border border-white/8 rounded-lg">
+ <div className="space-y-3 p-3 bg-white/3 border border-white/8 squircle-element">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<Icon icon="mdi:vector-line" width="16" className="text-white/50" />
@@ -291,7 +291,7 @@ export function ZoomFragmentEditor({
</div>
</div>
) : (
- <div className="p-3 bg-amber-500/10 border border-amber-500/20 rounded-lg">
+ <div className="p-3 bg-amber-500/10 border border-amber-500/20 squircle-element">
<div className="flex items-center gap-2 text-xs text-amber-400/80">
<span>{t("movement.tooShort")}</span>
</div>
@@ -301,7 +301,7 @@ export function ZoomFragmentEditor({
</div>
{/* 3D effect */}
- <div className="space-y-3 p-3 bg-white/3 border border-white/8 rounded-lg">
+ <div className="space-y-3 p-3 bg-white/3 border border-white/8 squircle-element">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<Icon icon="mdi:cube-outline" width="16" className="text-white/50" />
@@ -323,7 +323,7 @@ export function ZoomFragmentEditor({
<span>{tCommon("effect3d.direction")}</span>
</div>
<div
- className="relative w-full aspect-square max-w-30 mx-auto bg-[#0A0A0A] rounded-md border border-[#262626] hover:border-[#404040] transition-colors cursor-crosshair overflow-hidden group"
+ className="relative w-full aspect-square mx-auto bg-[#0A0A0A] squircle-element border border-[#262626] hover:border-[#404040] transition-colors cursor-crosshair overflow-hidden group"
onClick={(e) => {
const rect = e.currentTarget.getBoundingClientRect();
const x = ((e.clientX - rect.left) / rect.width) * 2 - 1;
@@ -335,12 +335,25 @@ export function ZoomFragmentEditor({
<div className="w-full h-px bg-[#1F1F1F]" />
<div className="h-full w-px bg-[#1F1F1F] absolute" />
</div>
+
<div className="absolute inset-0 flex items-center justify-center pointer-events-none">
- <div className="w-19 h-13 border border-gray-500/50 bg-gray-500/10 rounded-sm transition-transform duration-300 ease-out" style={{ transform: `perspective(60px) rotateX(${fragment.perspective3DAngleX ?? 0}deg) rotateY(${fragment.perspective3DAngleY ?? 0}deg)` }} />
+ <div
+ className="w-40 h-28 border border-gray-500/40 bg-gray-500/10 rounded-md transition-transform duration-300 ease-out shadow-[0_4px_20px_rgba(0,0,0,0.4)]"
+ style={{ transform: `perspective(120px) rotateX(${fragment.perspective3DAngleX ?? 0}deg) rotateY(${fragment.perspective3DAngleY ?? 0}deg)` }}
+ />
</div>
- <div className="absolute w-2.5 h-2.5 bg-gray-300 rounded-full shadow-[0_0_8px_rgba(255,255,255,0.2)] transition-all duration-300 ease-out z-10" style={{ left: `${50 + (-(fragment.perspective3DAngleY ?? (-(fragment.focusX - 50) / 50 * 15)) / 45) * 50}%`, top: `${50 + ((fragment.perspective3DAngleX ?? ((fragment.focusY - 50) / 50 * 15)) / 45) * 50}%`, transform: 'translate(-50%, -50%)' }} />
+
+ <div
+ className="absolute w-2.5 h-2.5 bg-gray-300 rounded-full shadow-[0_0_8px_rgba(255,255,255,0.4)] transition-all duration-300 ease-out z-10"
+ style={{
+ left: `${50 + (-(fragment.perspective3DAngleY ?? (-(fragment.focusX - 50) / 50 * 15)) / 45) * 50}%`,
+ top: `${50 + ((fragment.perspective3DAngleX ?? ((fragment.focusY - 50) / 50 * 15)) / 45) * 50}%`,
+ transform: 'translate(-50%, -50%)'
+ }}
+ />
</div>
- <p className="text-[10px] text-white/30 text-center">{tCommon("effect3d.directionHint")}</p>
+
+ <p className="text-[11px] text-white/30 text-center">{tCommon("effect3d.directionHint")}</p>
</div>
</div>
)}
diff --git a/components/ui/SliderControl.tsx b/components/ui/SliderControl.tsx
index 7956df9..63537fc 100644
--- a/components/ui/SliderControl.tsx
+++ b/components/ui/SliderControl.tsx
@@ -1,7 +1,6 @@
"use client";
-
import { Icon } from "@iconify/react";
-import { useRef, useState, useEffect } from "react";
+import { useRef, useState, useEffect, useCallback } from "react";
interface SliderControlProps {
icon?: string;
@@ -15,35 +14,43 @@ interface SliderControlProps {
onChangeEnd?: () => void;
}
-export function SliderControl({ icon, label, value, min = 0, max = 100, step = 1, suffix = "", onChange, onChangeEnd }: SliderControlProps) {
+export function SliderControl({
+ icon,
+ label,
+ value,
+ min = 0,
+ max = 100,
+ step = 1,
+ suffix = "",
+ onChange,
+ onChangeEnd,
+}: SliderControlProps) {
const [isDragging, setIsDragging] = useState(false);
const sliderRef = useRef<HTMLDivElement>(null);
- const handleMouseDown = () => {
- setIsDragging(true);
- };
+ const updateValue = useCallback(
+ (clientX: number) => {
+ if (!sliderRef.current || !onChange) return;
+ const rect = sliderRef.current.getBoundingClientRect();
+ const percentage = Math.max(0, Math.min(100, ((clientX - rect.left) / rect.width) * 100));
+ const rawValue = (percentage / 100) * (max - min) + min;
+ const newValue = Math.round(rawValue / step) * step;
+ onChange(Math.max(min, Math.min(max, parseFloat(newValue.toFixed(1)))));
+ },
+ [max, min, onChange, step]
+ );
- const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
- if (!sliderRef.current || !onChange) return;
+ const handleMouseDown = () => setIsDragging(true);
- const rect = sliderRef.current.getBoundingClientRect();
- const percentage = Math.max(0, Math.min(100, ((e.clientX - rect.left) / rect.width) * 100));
- const rawValue = (percentage / 100) * (max - min) + min;
- const newValue = Math.round(rawValue / step) * step;
- onChange(Math.max(min, Math.min(max, parseFloat(newValue.toFixed(1)))));
+ const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
+ updateValue(e.clientX);
};
useEffect(() => {
if (!isDragging) return;
const handleMouseMove = (e: MouseEvent) => {
- if (!sliderRef.current || !onChange) return;
-
- const rect = sliderRef.current.getBoundingClientRect();
- const percentage = Math.max(0, Math.min(100, ((e.clientX - rect.left) / rect.width) * 100));
- const rawValue = (percentage / 100) * (max - min) + min;
- const newValue = Math.round(rawValue / step) * step;
- onChange(Math.max(min, Math.min(max, parseFloat(newValue.toFixed(1)))));
+ updateValue(e.clientX);
};
const handleMouseUp = () => {
@@ -51,44 +58,45 @@ export function SliderControl({ icon, label, value, min = 0, max = 100, step = 1
onChangeEnd?.();
};
- document.addEventListener('mousemove', handleMouseMove);
- document.addEventListener('mouseup', handleMouseUp);
+ document.addEventListener("mousemove", handleMouseMove);
+ document.addEventListener("mouseup", handleMouseUp);
return () => {
- document.removeEventListener('mousemove', handleMouseMove);
- document.removeEventListener('mouseup', handleMouseUp);
+ document.removeEventListener("mousemove", handleMouseMove);
+ document.removeEventListener("mouseup", handleMouseUp);
};
- }, [isDragging, min, max, step, onChange, onChangeEnd]);
+ }, [isDragging, updateValue, onChangeEnd]);
- const displayPercentage = Math.round(((value - min) / (max - min)) * 100);
+ const displayPercentage = Math.max(0, Math.min(100, ((value - min) / (max - min)) * 100));
+ const displayValue = step < 1 ? value.toFixed(1) : value;
return (
- <div>
- <div className="flex items-center gap-2 text-xs mb-2 text-white/60">
- {icon && <Icon icon={icon} width="16" />}
- <span>{label}</span>
- </div>
- <div className="flex items-center gap-3">
- <div
- ref={sliderRef}
- className="flex-1 h-1 bg-[#27272A] rounded-full relative cursor-pointer"
- onClick={handleClick}
- onMouseDown={handleMouseDown}
- >
- <div
- className="absolute left-0 top-0 h-full bg-gradient-primary rounded-full"
- style={{ width: `${displayPercentage}%` }}
- ></div>
- <div
- className="absolute top-1/2 -translate-y-1/2 size-3 bg-white/70 rounded-full border border-white shadow"
- style={{ left: `calc(${displayPercentage}% - 7px)` }}
- ></div>
+ <div
+ ref={sliderRef}
+ className="relative flex h-[30px] w-full cursor-pointer touch-none select-none items-center rounded-lg bg-[#18181b] overflow-hidden border border-white/5"
+ onClick={handleClick}
+ onMouseDown={handleMouseDown}
+ >
+ <div
+ className="absolute bottom-0 left-0 top-0 bg-white/10 transition-all duration-75 ease-out"
+ style={{ width: `${displayPercentage}%` }}
+ />
+ <div
+ className="absolute top-[6px] bottom-[6px] w-[2px] rounded-full bg-white/90 shadow-[0_0_4px_rgba(0,0,0,0.5)] transition-all duration-75 ease-out z-20"
+ style={{ left: `calc(${displayPercentage}% - 1px)` }}
+ />
+
+ <div className="pointer-events-none absolute inset-0 z-10 flex items-center justify-between px-3">
+ <div className="flex items-center gap-2 text-[12px] font-medium text-white/50">
+ {icon && <Icon icon={icon} width="16" />}
+ <span>{label}</span>
</div>
- <span className="text-[11px] font-mono text-white/50 rounded text-center">
- {step < 1 ? value.toFixed(1) : value}{suffix}
+ <span className="text-[12px] font-mono text-white/50">
+ {displayValue}
+ {suffix}
</span>
</div>
</div>
);
-}
+}
\ No newline at end of file
diff --git a/lib/wallpaper.catalog.ts b/lib/wallpaper.catalog.ts
index 12ccbc4..2e66321 100644
--- a/lib/wallpaper.catalog.ts
+++ b/lib/wallpaper.catalog.ts
@@ -28,7 +28,7 @@ interface CategoryConfig {
}
const CATEGORY_CONFIGS: CategoryConfig[] = [
- { id: 'desktop', label: 'desktop', icon: 'heroicons:computer-desktop-solid', primary: true, count: 73 },
+ { id: 'desktop', label: 'desktop', icon: 'heroicons:computer-desktop-solid', primary: true, count: 75 },
{ id: 'gradient', label: 'gradient', icon: 'solar:mirror-left-bold', primary: true, count: 91 },
{ id: 'pattern', label: 'pattern', icon: 'solar:palette-round-bold', primary: false, count: 49 },
{ id: 'minimal', label: 'minimal', icon: 'solar:sun-2-bold', primary: false, count: 65 },
diff --git a/public/images/backgrounds/desktop/desktop-74.avif b/public/images/backgrounds/desktop/desktop-74.avif
new file mode 100644
index 0000000..7cb4457
Binary files /dev/null and b/public/images/backgrounds/desktop/desktop-74.avif differ
diff --git a/public/images/backgrounds/desktop/desktop-74.jpg b/public/images/backgrounds/desktop/desktop-74.jpg
new file mode 100644
index 0000000..03cc4cb
Binary files /dev/null and b/public/images/backgrounds/desktop/desktop-74.jpg differ
diff --git a/public/images/backgrounds/desktop/desktop-75.avif b/public/images/backgrounds/desktop/desktop-75.avif
new file mode 100644
index 0000000..e4697c3
Binary files /dev/null and b/public/images/backgrounds/desktop/desktop-75.avif differ
diff --git a/public/images/backgrounds/desktop/desktop-75.jpg b/public/images/backgrounds/desktop/desktop-75.jpg
new file mode 100644
index 0000000..9aa4f51
Binary files /dev/null and b/public/images/backgrounds/desktop/desktop-75.jpg differ
diff --git a/public/images/backgrounds/minimal/minimal-05.avif b/public/images/backgrounds/minimal/minimal-05.avif
index c68e4db..1466462 100644
Binary files a/public/images/backgrounds/minimal/minimal-05.avif and b/public/images/backgrounds/minimal/minimal-05.avif differ
diff --git a/public/images/backgrounds/minimal/minimal-05.jpg b/public/images/backgrounds/minimal/minimal-05.jpg
index eb52523..9f90171 100644
Binary files a/public/images/backgrounds/minimal/minimal-05.jpg and b/public/images/backgrounds/minimal/minimal-05.jpg differ
diff --git a/public/images/backgrounds/minimal/minimal-06.avif b/public/images/backgrounds/minimal/minimal-06.avif
index db0de61..9d75ff1 100644
Binary files a/public/images/backgrounds/minimal/minimal-06.avif and b/public/images/backgrounds/minimal/minimal-06.avif differ
diff --git a/public/images/backgrounds/minimal/minimal-06.jpg b/public/images/backgrounds/minimal/minimal-06.jpg
index dd996bc..c86388f 100644
Binary files a/public/images/backgrounds/minimal/minimal-06.jpg and b/public/images/backgrounds/minimal/minimal-06.jpg differ