1
0
mirror of https://github.com/flarum/core.git synced 2025-08-07 00:47:00 +02:00

Rename UserPageSidebar to AffixedSidebar, make it a much more reusable component

This commit is contained in:
Alexander Skvortsov
2020-08-10 00:38:02 -04:00
committed by Franz Liedke
parent 5ccf9d420e
commit a376c0e596
2 changed files with 10 additions and 11 deletions

View File

@@ -1,11 +1,8 @@
import Component from "../../common/Component";
import Component from '../../common/Component';
export default class UserPageSidebar extends Component {
export default class AffixedSidebar extends Component {
view(vnode) {
return (
<nav className="sideNav UserPage-nav">
<ul>{vnode.children}</ul>
</nav>)
return vnode.children[0];
}
onresize(vnode) {
@@ -27,7 +24,7 @@ export default class UserPageSidebar extends Component {
bottom: () => (this.bottom = $footer.outerHeight(true)),
},
});
};
}
oncreate(vnode) {
super.oncreate(vnode);

View File

@@ -1,12 +1,12 @@
import Page from '../../common/components/Page';
import ItemList from '../../common/utils/ItemList';
import affixSidebar from '../utils/affixSidebar';
import UserCard from './UserCard';
import LoadingIndicator from '../../common/components/LoadingIndicator';
import SelectDropdown from '../../common/components/SelectDropdown';
import LinkButton from '../../common/components/LinkButton';
import Separator from '../../common/components/Separator';
import listItems from '../../common/helpers/listItems';
import UserPageSidebar from './AffixedSidebar';
/**
* The `UserPage` component shows a user's profile. It can be extended to show
@@ -42,9 +42,11 @@ export default class UserPage extends Page {
/>,
<div className="container">
<div className="sideNavContainer">
<nav className="sideNav UserPage-nav" config={affixSidebar}>
<ul>{listItems(this.sidebarItems().toArray())}</ul>
</nav>
<UserPageSidebar>
<nav className="sideNav UserPage-nav">
<ul>{listItems(this.sidebarItems().toArray())}</ul>
</nav>
</UserPageSidebar>
<div className="sideNavOffset UserPage-content">{this.content()}</div>
</div>
</div>,