Skip to content

Commit

Permalink
fix(ui): remove animation from the settings modal (#1286)
Browse files Browse the repository at this point in the history
This is a small optimization to the Settings modal. In my opinion, we
don't need animation here. By removing the animation, it makes the UI
feel "snappy" and this should perform better when other elements cause
performance issues.

The user experience goal of the Settings section is to provide users
with access to these more advanced settings as quickly and smoothly as
possible. The timing of the animations actually slows access down and
gets in the way of the optimal experience.

https://www.loom.com/share/38ff2cda3b9641dba7dde2488a56e015
  • Loading branch information
peps authored Dec 18, 2024
1 parent 57a3086 commit 5e7d495
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
8 changes: 2 additions & 6 deletions src/containers/floating/Settings/SettingsModal.styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { m } from 'framer-motion';
import styled from 'styled-components';

export const Container = styled.div`
Expand Down Expand Up @@ -58,11 +57,8 @@ export const variants = {
transition,
},
};
export const SectionWrapper = styled(m.div).attrs({
initial: 'initial',
animate: 'visible',
exit: 'exit',
})`

export const SectionWrapper = styled.div`
max-width: 100%;
display: flex;
flex-direction: column;
Expand Down
9 changes: 2 additions & 7 deletions src/containers/floating/Settings/SettingsModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useState } from 'react';
import { AnimatePresence } from 'framer-motion';
import { useTranslation } from 'react-i18next';
import { IoClose } from 'react-icons/io5';

Expand All @@ -23,7 +22,7 @@ import {
ReleaseNotes,
} from './sections';

import { Container, ContentContainer, HeaderContainer, SectionWrapper, variants } from './SettingsModal.styles.ts';
import { Container, ContentContainer, HeaderContainer, SectionWrapper } from './SettingsModal.styles.ts';

const markups = {
general: <GeneralSettings />,
Expand Down Expand Up @@ -65,11 +64,7 @@ export default function SettingsModal() {
</IconButton>
</HeaderContainer>

<AnimatePresence mode="wait">
<SectionWrapper variants={variants} key={activeSection}>
{sectionMarkup}
</SectionWrapper>
</AnimatePresence>
<SectionWrapper key={activeSection}>{sectionMarkup}</SectionWrapper>
</ContentContainer>
</Container>
<RestartDialog />
Expand Down

0 comments on commit 5e7d495

Please sign in to comment.