Skip to content

Commit 0e41272

Browse files
committed
refactor(properties): extract align icons to their own file
Splits the three centre-axis SVG icons out of AlignButtons.tsx so the button-row file stays focused on layout/dispatch. Matches the pattern of ui/DragHandleIcon.tsx for single-purpose inline icons.
1 parent 732095e commit 0e41272

2 files changed

Lines changed: 35 additions & 32 deletions

File tree

‎src/components/Properties/AlignButtons.tsx‎

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,6 @@
11
import { useT } from "../../lib/useT";
22
import type { AlignAxis } from "../../lib/alignment";
3-
4-
interface IconProps {
5-
className?: string;
6-
}
7-
8-
function CenterHIcon({ className }: IconProps) {
9-
return (
10-
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" aria-hidden="true" className={className}>
11-
<line x1="8" y1="1.5" x2="8" y2="14.5" strokeDasharray="2 2" strokeWidth="1" />
12-
<rect x="3" y="5" width="10" height="6" strokeWidth="1" />
13-
</svg>
14-
);
15-
}
16-
17-
function CenterVIcon({ className }: IconProps) {
18-
return (
19-
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" aria-hidden="true" className={className}>
20-
<line x1="1.5" y1="8" x2="14.5" y2="8" strokeDasharray="2 2" strokeWidth="1" />
21-
<rect x="5" y="3" width="6" height="10" strokeWidth="1" />
22-
</svg>
23-
);
24-
}
25-
26-
function CenterBothIcon({ className }: IconProps) {
27-
return (
28-
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" aria-hidden="true" className={className}>
29-
<line x1="8" y1="1.5" x2="8" y2="14.5" strokeDasharray="2 2" strokeWidth="1" />
30-
<line x1="1.5" y1="8" x2="14.5" y2="8" strokeDasharray="2 2" strokeWidth="1" />
31-
<rect x="5" y="5" width="6" height="6" strokeWidth="1" />
32-
</svg>
33-
);
34-
}
3+
import { CenterHIcon, CenterVIcon, CenterBothIcon } from "./AlignIcons";
354

365
const BUTTON_CLS =
376
"p-1.5 rounded border border-border text-muted hover:text-text hover:bg-surface-2 transition-colors";
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
interface IconProps {
2+
className?: string;
3+
}
4+
5+
/** Object centred on a vertical dashed line — represents horizontal centring. */
6+
export function CenterHIcon({ className }: IconProps) {
7+
return (
8+
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" aria-hidden="true" className={className}>
9+
<line x1="8" y1="1.5" x2="8" y2="14.5" strokeDasharray="2 2" strokeWidth="1" />
10+
<rect x="3" y="5" width="10" height="6" strokeWidth="1" />
11+
</svg>
12+
);
13+
}
14+
15+
/** Object centred on a horizontal dashed line — represents vertical centring. */
16+
export function CenterVIcon({ className }: IconProps) {
17+
return (
18+
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" aria-hidden="true" className={className}>
19+
<line x1="1.5" y1="8" x2="14.5" y2="8" strokeDasharray="2 2" strokeWidth="1" />
20+
<rect x="5" y="3" width="6" height="10" strokeWidth="1" />
21+
</svg>
22+
);
23+
}
24+
25+
/** Object on the cross-hair of two dashed lines — represents bi-axial centring. */
26+
export function CenterBothIcon({ className }: IconProps) {
27+
return (
28+
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" aria-hidden="true" className={className}>
29+
<line x1="8" y1="1.5" x2="8" y2="14.5" strokeDasharray="2 2" strokeWidth="1" />
30+
<line x1="1.5" y1="8" x2="14.5" y2="8" strokeDasharray="2 2" strokeWidth="1" />
31+
<rect x="5" y="5" width="6" height="6" strokeWidth="1" />
32+
</svg>
33+
);
34+
}

0 commit comments

Comments
 (0)