Skip to content

Commit

Permalink
Various improvements to single column layout (mastodon#10809)
Browse files Browse the repository at this point in the history
- Add potential side panels to single column layout
- Hide FAB on large screens
  • Loading branch information
Gargron authored and hiyuki2578 committed Oct 2, 2019
1 parent 176fe75 commit d042630
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 14 deletions.
27 changes: 17 additions & 10 deletions app/javascript/mastodon/features/ui/components/columns_area.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,28 @@ class ColumnsArea extends ImmutablePureComponent {
if (singleColumn) {
const floatingActionButton = shouldHideFAB(this.context.router.history.location.pathname) ? null : <Link key='floating-action-button' to='/statuses/new' className='floating-action-button' aria-label={intl.formatMessage(messages.publish)}><Icon id='pencil' /></Link>;

return columnIndex !== -1 ? [
<TabsBar key='tabs' />,

const content = columnIndex !== -1 ? (
<ReactSwipeableViews key='content' index={columnIndex} onChangeIndex={this.handleSwipe} onTransitionEnd={this.handleAnimationEnd} animateTransitions={shouldAnimate} springConfig={{ duration: '400ms', delay: '0s', easeFunction: 'ease' }} style={{ height: '100%' }}>
{links.map(this.renderView)}
</ReactSwipeableViews>,
</ReactSwipeableViews>
) : (
<div key='content' className='columns-area columns-area--mobile'>{children}</div>
);

return (
<div className='columns-area__panels'>
<div className='columns-area__panels__pane' />

floatingActionButton,
] : [
<TabsBar key='tabs' />,
<div className='columns-area__panels__main'>
<TabsBar key='tabs' />
{content}
</div>

<div key='content' className='columns-area columns-area--mobile'>{children}</div>,
<div className='columns-area__panels__pane' />

floatingActionButton,
];
{floatingActionButton}
</div>
);
}

return (
Expand Down
43 changes: 39 additions & 4 deletions app/javascript/styles/mastodon/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,39 @@ a.account__display-name {
&.unscrollable {
overflow-x: hidden;
}

&__panels {
display: flex;
justify-content: center;
width: 100%;
height: 100%;

&__pane {
flex: 1 1 auto;
height: 100%;
overflow: hidden;
pointer-events: none;
display: flex;
justify-content: flex-end;

&__inner {
pointer-events: auto;
height: 100%;
}
}

&__main {
box-sizing: border-box;
width: 100%;
max-width: 600px;
display: flex;
flex-direction: column;

@media screen and (min-width: 360px) {
padding: 0 10px;
}
}
}
}

.react-swipeable-view-container {
Expand Down Expand Up @@ -1936,7 +1969,6 @@ a.account__display-name {
.columns-area--mobile {
flex-direction: column;
width: 100%;
max-width: 600px;
margin: 0 auto;

.column,
Expand All @@ -1952,7 +1984,7 @@ a.account__display-name {
}

@media screen and (min-width: 360px) {
padding: 10px;
padding: 10px 0;
}

@media screen and (min-width: 630px) {
Expand Down Expand Up @@ -2013,8 +2045,7 @@ a.account__display-name {
.tabs-bar {
margin: 10px auto;
margin-bottom: 0;
width: calc(100% - 20px);
max-width: 600px;
width: 100%;
}

.react-swipeable-view-container .columns-area--mobile {
Expand Down Expand Up @@ -5427,6 +5458,10 @@ noscript {
&:active {
background: lighten($ui-highlight-color, 7%);
}

@media screen and (min-width: 630px) {
display: none;
}
}

.account__header__content {
Expand Down

0 comments on commit d042630

Please sign in to comment.