mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +03:00
Merge pull request #4825 from matrix-org/travis/room-list/default-lists
Allow the user to resize the new sublists to 1 tile
This commit is contained in:
commit
4d47dcaabd
2 changed files with 9 additions and 2 deletions
|
@ -117,7 +117,7 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
|
|||
};
|
||||
|
||||
private onShowLessClick = () => {
|
||||
this.props.layout.visibleTiles = this.props.layout.minVisibleTiles;
|
||||
this.props.layout.visibleTiles = this.props.layout.defaultVisibleTiles;
|
||||
this.forceUpdate(); // because the layout doesn't trigger a re-render
|
||||
};
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ export class ListLayout {
|
|||
}
|
||||
|
||||
public get visibleTiles(): number {
|
||||
if (this._n === 0) return this.defaultVisibleTiles;
|
||||
return Math.max(this._n, this.minVisibleTiles);
|
||||
}
|
||||
|
||||
|
@ -78,7 +79,13 @@ export class ListLayout {
|
|||
public get minVisibleTiles(): number {
|
||||
// the .65 comes from the CSS where the show more button is
|
||||
// mathematically 65% of a tile when floating.
|
||||
return 4.65;
|
||||
return 1.65;
|
||||
}
|
||||
|
||||
public get defaultVisibleTiles(): number {
|
||||
// TODO: Remove dogfood flag
|
||||
const val = Number(localStorage.getItem("mx_dogfood_rl_defTiles") || 4);
|
||||
return val + 0.65; // see minVisibleTiles for where the .65 comes from
|
||||
}
|
||||
|
||||
public calculateTilesToPixelsMin(maxTiles: number, n: number, possiblePadding: number): number {
|
||||
|
|
Loading…
Reference in a new issue