Fix addon cards and reduced motion

This commit is contained in:
Zerebos 2024-02-26 19:31:06 -05:00
parent 5955d04cd2
commit 9dc12f4619
No known key found for this signature in database
GPG Key ID: 79BE50E3D28D5686
2 changed files with 7 additions and 3 deletions

View File

@ -28,7 +28,7 @@
.bd-addon-list.bd-grid-view { .bd-addon-list.bd-grid-view {
display: grid; display: grid;
grid-template-columns: auto auto; grid-template-columns: 1fr 1fr;
column-gap: 10px; column-gap: 10px;
row-gap: 10px; row-gap: 10px;
} }

View File

@ -19,14 +19,18 @@ export const Styles = Object.freeze({
}); });
const AccessibilityContext = WebpackModules.getModule(m => m?._currentValue?.reducedMotion, {searchExports: true});
const FocusLock = WebpackModules.getModule(m => m?.render?.toString().includes("impressionProperties") && m?.render?.toString().includes(".Provider"), {searchExports: true}) ?? React.Fragment; const FocusLock = WebpackModules.getModule(m => m?.render?.toString().includes("impressionProperties") && m?.render?.toString().includes(".Provider"), {searchExports: true}) ?? React.Fragment;
export default function ModalRoot({className, transitionState, children, size = Sizes.DYNAMIC, style = Styles.CUSTOM}) { export default function ModalRoot({className, transitionState, children, size = Sizes.DYNAMIC, style = Styles.CUSTOM}) {
const visible = transitionState == 0 || transitionState == 1; // 300 ms const visible = transitionState == 0 || transitionState == 1; // 300 ms
// const visible = transitionState;
const preferences = React.useContext(AccessibilityContext ?? {});
const reducedMotion = preferences?.reducedMotion?.enabled ?? document.documentElement?.classList.contains("reduce-motion");
const springStyles = Spring.useSpring({ const springStyles = Spring.useSpring({
opacity: visible ? 1 : 0, opacity: visible ? 1 : 0,
transform: visible ? "scale(1)" : "scale(0.7)", transform: visible || reducedMotion ? "scale(1)" : "scale(0.7)",
config: { config: {
duration: visible ? 300 : 100, duration: visible ? 300 : 100,
easing: visible ? Anims.Easing.inOut(Anims.Easing.back()) : Anims.Easing.quad, easing: visible ? Anims.Easing.inOut(Anims.Easing.back()) : Anims.Easing.quad,