Merge pull request #4932 from matrix-org/travis/room-list/invisible-show-more
Potential solution to supporting transparent 'show more' buttons
This commit is contained in:
commit
f58a0a7538
3 changed files with 13 additions and 21 deletions
|
@ -562,10 +562,8 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
|
|||
if (visibleTiles.length > 0) {
|
||||
const layout = this.layout; // to shorten calls
|
||||
|
||||
const maxTilesFactored = layout.tilesWithResizerBoxFactor(this.numTiles);
|
||||
const showMoreBtnClasses = classNames({
|
||||
'mx_RoomSublist2_showNButton': true,
|
||||
'mx_RoomSublist2_isCutting': this.state.isResizing && layout.visibleTiles < maxTilesFactored,
|
||||
});
|
||||
|
||||
// If we're hiding rooms, show a 'show more' button to the user. This button
|
||||
|
@ -644,6 +642,14 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
|
|||
const tilesWithoutPadding = Math.min(relativeTiles, layout.visibleTiles);
|
||||
const tilesPx = layout.calculateTilesToPixelsMin(relativeTiles, tilesWithoutPadding, padding);
|
||||
|
||||
// Now that we know our padding constraints, let's find out if we need to chop off the
|
||||
// last rendered visible tile so it doesn't collide with the 'show more' button
|
||||
let visibleUnpaddedTiles = Math.round(layout.visibleTiles - layout.pixelsToTiles(padding));
|
||||
if (visibleUnpaddedTiles === visibleTiles.length - 1) {
|
||||
const placeholder = <div className="mx_RoomSublist2_placeholder" key='placeholder' />;
|
||||
visibleTiles.splice(visibleUnpaddedTiles, 1, placeholder);
|
||||
}
|
||||
|
||||
const dimensions = {
|
||||
height: tilesPx,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue