mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
},
|
||||
};
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user