[dyad] Making the position grid more minimal - wrote 1 file(s)
This commit is contained in:
@@ -26,20 +26,23 @@ interface ObjectPositionControlProps {
|
|||||||
|
|
||||||
export function ObjectPositionControl({ value, onChange }: ObjectPositionControlProps) {
|
export function ObjectPositionControl({ value, onChange }: ObjectPositionControlProps) {
|
||||||
return (
|
return (
|
||||||
<div className="grid grid-cols-3 gap-1 w-24 h-24 p-1 rounded-md bg-muted">
|
<div className="grid grid-cols-3 gap-px w-16 h-16 rounded-md border bg-border overflow-hidden">
|
||||||
{positions.map((pos) => (
|
{positions.map((pos) => (
|
||||||
<button
|
<button
|
||||||
key={pos}
|
key={pos}
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => onChange(pos)}
|
onClick={() => onChange(pos)}
|
||||||
className={cn(
|
className={cn(
|
||||||
"rounded-sm transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
"flex items-center justify-center bg-background transition-colors focus:outline-none focus:z-10 focus:ring-2 focus:ring-ring",
|
||||||
value === pos
|
"hover:bg-accent",
|
||||||
? "bg-primary"
|
value === pos && "bg-accent"
|
||||||
: "bg-muted-foreground/20 hover:bg-muted-foreground/40"
|
|
||||||
)}
|
)}
|
||||||
aria-label={`Set object position to ${pos.replace(' ', ' ')}`}
|
aria-label={`Set object position to ${pos.replace(' ', ' ')}`}
|
||||||
/>
|
>
|
||||||
|
{value === pos && (
|
||||||
|
<div className="w-2 h-2 rounded-full bg-primary ring-1 ring-primary-foreground" />
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user