Skip to content

Commit

Permalink
[DDW] Fix minor UI/UX issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaglumac committed Jan 14, 2021
1 parent f0a7247 commit 32ed222
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
19 changes: 19 additions & 0 deletions source/renderer/app/components/settings/SettingsLayout.js
Expand Up @@ -7,10 +7,29 @@ import styles from './SettingsLayout.scss';
type Props = {
children: Node,
menu: Node,
activePage: string,
};

@observer
export default class SettingsLayout extends Component<Props> {
scrollableDomElement: ?HTMLElement = null;

componentDidMount() {
this.scrollableDomElement = document.querySelector(
'.SettingsLayout_settingsPaneWrapper'
);
}

componentDidUpdate(prevProps) {
const didActivePageChange = this.props.activePage !== prevProps.activePage;
if (
this.scrollableDomElement instanceof HTMLElement &&
didActivePageChange
) {
this.scrollableDomElement.scrollTop = 0;
}
}

render() {
const { menu, children } = this.props;
return (
Expand Down
Expand Up @@ -67,5 +67,5 @@

.showMoreTransactionsButton {
display: block !important;
margin: 30px auto;
margin: 30px auto 20px;
}
7 changes: 5 additions & 2 deletions source/renderer/app/containers/settings/Settings.js
Expand Up @@ -27,7 +27,8 @@ export default class Settings extends Component<InjectedContainerProps> {

render() {
const { isFlight } = global;
const { actions, children } = this.props;
const { actions, children, stores } = this.props;
const { location } = stores.router;
const menu = (
<SettingsMenu
isFlight={isFlight}
Expand All @@ -37,7 +38,9 @@ export default class Settings extends Component<InjectedContainerProps> {
);
return (
<Layout>
<SettingsLayout menu={menu}>{children}</SettingsLayout>
<SettingsLayout menu={menu} activePage={location.pathname}>
{children}
</SettingsLayout>
</Layout>
);
}
Expand Down
4 changes: 3 additions & 1 deletion storybook/stories/settings/utils/SettingsWrapper.js
Expand Up @@ -38,7 +38,9 @@ export default (story: Object, context: Object) => {
<StoryDecorator>
<StoryProvider>
<StoryLayout activeSidebarCategory="/settings" {...context}>
<SettingsLayout menu={menu}>{storyWithKnobs}</SettingsLayout>
<SettingsLayout menu={menu} activePage="/settings">
{storyWithKnobs}
</SettingsLayout>
</StoryLayout>
</StoryProvider>
</StoryDecorator>
Expand Down

0 comments on commit 32ed222

Please sign in to comment.