Make magnify icon always visible, transition from magnify to minimize (#197)

I'm updating the magnify button to be always visible and animate a
transition between being a "Magnify" button and a "Minimize" button.

This also cleans up some text shrinking behavior in the block frame
header so the end icons are always visible.

Also fixes some height discrepancies in the block frame header.

Also implements a `prefers-reduced-motion` query for the tilelayout and
block frame to ensure transitions are not set if the user does not want
them.
This commit is contained in:
Evan Simkowitz
2024-08-05 16:13:26 -07:00
committed by GitHub
parent 2f8642db5b
commit e29cb2debe
12 changed files with 131 additions and 16 deletions
+36
View File
@@ -0,0 +1,36 @@
.magnify-icon {
display: inline-block;
width: 15px;
height: 15px;
svg {
#arrow1 {
transform: rotate(180deg);
transform-origin: calc(29.167% + 4px) calc(70.833% + 4px); // account for path offset in the svg itself
}
#arrow2 {
transform: rotate(-180deg);
transform-origin: calc(70.833% + 4px) calc(29.167% + 4px);
}
#arrow1,
#arrow2 {
transition: transform 300ms ease-in;
}
}
&.enabled {
svg {
#arrow1,
#arrow2 {
transform: rotate(0deg);
}
}
}
}
@media (prefers-reduced-motion) {
.magnify-icon svg {
#arrow1,
#arrow2 {
transition: none;
}
}
}
+25
View File
@@ -0,0 +1,25 @@
import type { Meta, StoryObj } from "@storybook/react";
import { MagnifyIcon } from "./magnify";
const meta = {
title: "Icons/Magnify",
component: MagnifyIcon,
args: {
enabled: true,
},
} satisfies Meta<typeof MagnifyIcon>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Enabled: Story = {
args: {
enabled: true,
},
};
export const Disabled: Story = {
args: {
enabled: false,
},
};
+15
View File
@@ -0,0 +1,15 @@
import clsx from "clsx";
import MagnifySVG from "../asset/magnify.svg";
import "./magnify.less";
interface MagnifyIconProps {
enabled: boolean;
}
export function MagnifyIcon({ enabled }: MagnifyIconProps) {
return (
<div className={clsx("magnify-icon", { enabled })}>
<MagnifySVG />
</div>
);
}