Skip to content

Commit e4b19ab

Browse files
Gargronhiyuki2578
authored andcommitted
Various improvements to single column layout (mastodon#10809)
- Add potential side panels to single column layout - Hide FAB on large screens
1 parent 468c164 commit e4b19ab

2 files changed

Lines changed: 56 additions & 14 deletions

File tree

app/javascript/mastodon/features/ui/components/columns_area.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,21 +163,28 @@ class ColumnsArea extends ImmutablePureComponent {
163163
if (singleColumn) {
164164
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>;
165165

166-
return columnIndex !== -1 ? [
167-
<TabsBar key='tabs' />,
168-
166+
const content = columnIndex !== -1 ? (
169167
<ReactSwipeableViews key='content' index={columnIndex} onChangeIndex={this.handleSwipe} onTransitionEnd={this.handleAnimationEnd} animateTransitions={shouldAnimate} springConfig={{ duration: '400ms', delay: '0s', easeFunction: 'ease' }} style={{ height: '100%' }}>
170168
{links.map(this.renderView)}
171-
</ReactSwipeableViews>,
169+
</ReactSwipeableViews>
170+
) : (
171+
<div key='content' className='columns-area columns-area--mobile'>{children}</div>
172+
);
173+
174+
return (
175+
<div className='columns-area__panels'>
176+
<div className='columns-area__panels__pane' />
172177

173-
floatingActionButton,
174-
] : [
175-
<TabsBar key='tabs' />,
178+
<div className='columns-area__panels__main'>
179+
<TabsBar key='tabs' />
180+
{content}
181+
</div>
176182

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

179-
floatingActionButton,
180-
];
185+
{floatingActionButton}
186+
</div>
187+
);
181188
}
182189

183190
return (

app/javascript/styles/mastodon/components.scss

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,39 @@ a.account__display-name {
17861786
&.unscrollable {
17871787
overflow-x: hidden;
17881788
}
1789+
1790+
&__panels {
1791+
display: flex;
1792+
justify-content: center;
1793+
width: 100%;
1794+
height: 100%;
1795+
1796+
&__pane {
1797+
flex: 1 1 auto;
1798+
height: 100%;
1799+
overflow: hidden;
1800+
pointer-events: none;
1801+
display: flex;
1802+
justify-content: flex-end;
1803+
1804+
&__inner {
1805+
pointer-events: auto;
1806+
height: 100%;
1807+
}
1808+
}
1809+
1810+
&__main {
1811+
box-sizing: border-box;
1812+
width: 100%;
1813+
max-width: 600px;
1814+
display: flex;
1815+
flex-direction: column;
1816+
1817+
@media screen and (min-width: 360px) {
1818+
padding: 0 10px;
1819+
}
1820+
}
1821+
}
17891822
}
17901823

17911824
.react-swipeable-view-container {
@@ -1936,7 +1969,6 @@ a.account__display-name {
19361969
.columns-area--mobile {
19371970
flex-direction: column;
19381971
width: 100%;
1939-
max-width: 600px;
19401972
margin: 0 auto;
19411973

19421974
.column,
@@ -1952,7 +1984,7 @@ a.account__display-name {
19521984
}
19531985

19541986
@media screen and (min-width: 360px) {
1955-
padding: 10px;
1987+
padding: 10px 0;
19561988
}
19571989

19581990
@media screen and (min-width: 630px) {
@@ -2013,8 +2045,7 @@ a.account__display-name {
20132045
.tabs-bar {
20142046
margin: 10px auto;
20152047
margin-bottom: 0;
2016-
width: calc(100% - 20px);
2017-
max-width: 600px;
2048+
width: 100%;
20182049
}
20192050

20202051
.react-swipeable-view-container .columns-area--mobile {
@@ -5427,6 +5458,10 @@ noscript {
54275458
&:active {
54285459
background: lighten($ui-highlight-color, 7%);
54295460
}
5461+
5462+
@media screen and (min-width: 630px) {
5463+
display: none;
5464+
}
54305465
}
54315466

54325467
.account__header__content {

0 commit comments

Comments
 (0)