Skip to content

Free open-source image editor for the browser

Hide the floating histogram on mobile before an image opens (#47)

Rodrigo Belfioref8cf4b3c7db7
diff --git a/src/app/editor/histogram.tsx b/src/app/editor/histogram.tsx
index a172dd3..05687bc 100644
--- a/src/app/editor/histogram.tsx
+++ b/src/app/editor/histogram.tsx
@@ -1,15 +1,19 @@
+import { cn } from "cn";
import { useRenderer } from "@/components/editor/pipeline";
import { Histogram } from "@/features/histogram";
import { ClippingControls } from "./clipping-controls";
const colors = ["#f25445", "#6bd175", "#5c8ffa"] as const;
-export function ImageHistogram() {
+export function ImageHistogram({ className }: { className?: string }) {
const renderer = useRenderer();
return (
<section
aria-label="Image histogram"
- className="group relative shrink-0 bg-neutral-900 max-md:absolute max-md:bottom-full max-md:left-3 max-md:z-10 max-md:mb-3 max-md:h-14 max-md:w-44 max-md:overflow-hidden max-md:border-0 max-md:bg-neutral-800/80 max-md:backdrop-blur-sm"
+ className={cn(
+ "group relative shrink-0 bg-neutral-900 max-md:absolute max-md:bottom-full max-md:left-3 max-md:z-10 max-md:mb-3 max-md:h-14 max-md:w-44 max-md:overflow-hidden max-md:border-0 max-md:bg-neutral-800/80 max-md:backdrop-blur-sm",
+ className,
+ )}
>
<ClippingControls />
<Histogram
diff --git a/src/app/editor/sidebar.tsx b/src/app/editor/sidebar.tsx
index 28ca621..702e665 100644
--- a/src/app/editor/sidebar.tsx
+++ b/src/app/editor/sidebar.tsx
@@ -39,7 +39,7 @@ export function EditorSidebar() {
export function PlaceholderSidebar() {
return (
<EditorPanel inert>
- <ImageHistogram />
+ <ImageHistogram className="max-md:hidden" />
<LayersSection />
<AdjustPanel />
</EditorPanel>