diff --git a/packages/vx-demo/src/components/Gallery.tsx b/packages/vx-demo/src/components/Gallery.tsx
index 195631bb4..8dd98e101 100644
--- a/packages/vx-demo/src/components/Gallery.tsx
+++ b/packages/vx-demo/src/components/Gallery.tsx
@@ -27,7 +27,7 @@ import BarStackHorizontal, {
background as horizontalBarstackBackground,
purple3 as horiztonalBarstackTextColor,
} from '../docs-v2/examples/vx-barstack-horizontal/Example';
-import Heatmap from './tiles/Heatmap';
+import Heatmaps from '../docs-v2/examples/vx-heatmap/Example';
import LineRadial from '../docs-v2/examples/vx-shape-line-radial/Example';
import Pies from '../docs-v2/examples/vx-shape-pie/Example';
import Trees from './tiles/Trees';
@@ -346,7 +346,9 @@ export default function Gallery() {
- {({ width, height }) => }
+ {({ width, height }) => (
+
+ )}
diff --git a/packages/vx-demo/src/components/tiles/Heatmap.tsx b/packages/vx-demo/src/docs-v2/examples/vx-heatmap/Example.tsx
similarity index 90%
rename from packages/vx-demo/src/components/tiles/Heatmap.tsx
rename to packages/vx-demo/src/docs-v2/examples/vx-heatmap/Example.tsx
index 51bd390d0..4d80b6180 100644
--- a/packages/vx-demo/src/components/tiles/Heatmap.tsx
+++ b/packages/vx-demo/src/docs-v2/examples/vx-heatmap/Example.tsx
@@ -3,7 +3,6 @@ import { Group } from '@vx/group';
import genBins, { Bin, Bins } from '@vx/mock-data/lib/generators/genBins';
import { scaleLinear } from '@vx/scale';
import { HeatmapCircle, HeatmapRect } from '@vx/heatmap';
-import { ShowProvidedProps } from '../../types';
const hot1 = '#77312f';
const hot2 = '#f33d15';
@@ -48,26 +47,26 @@ const opacityScale = scaleLinear
({
domain: [0, colorMax],
});
+type Props = {
+ width: number;
+ height: number;
+ margin?: { top: number; right: number; bottom: number; left: number };
+ separation?: number;
+ events?: boolean;
+};
+
+const defaultMargin = { top: 10, left: 20, right: 20, bottom: 110 };
+
export default ({
width,
height,
events = false,
- margin = {
- top: 10,
- left: 20,
- right: 20,
- bottom: 110,
- },
+ margin = defaultMargin,
separation = 20,
-}: ShowProvidedProps & { separation?: number }) => {
- if (width < 10) return null;
-
+}: Props) => {
// bounds
- let size = width;
- if (size > margin.left + margin.right) {
- size = width - margin.left - margin.right - separation;
- }
-
+ const size =
+ width > margin.left + margin.right ? width - margin.left - margin.right - separation : width;
const xMax = size / 2;
const yMax = height - margin.bottom - margin.top;
@@ -78,7 +77,7 @@ export default ({
xScale.range([0, xMax]);
yScale.range([yMax, 0]);
- return (
+ return width < 10 ? null : (