Fix follow suggestions scrolling on mobile view

Also simplify the CSS a bit and bring it closer to upstream.
This commit is contained in:
Claire 2021-07-12 08:07:04 +02:00
parent 0c6dfcf3de
commit a85eb7d930
3 changed files with 41 additions and 62 deletions

View file

@ -71,7 +71,7 @@ class SearchResults extends ImmutablePureComponent {
); );
} else if(results.get('statuses') && results.get('statuses').size === 0 && !searchEnabled && !(searchTerm.startsWith('@') || searchTerm.startsWith('#') || searchTerm.includes(' '))) { } else if(results.get('statuses') && results.get('statuses').size === 0 && !searchEnabled && !(searchTerm.startsWith('@') || searchTerm.startsWith('#') || searchTerm.includes(' '))) {
statuses = ( statuses = (
<section> <section className='search-results__section'>
<h5><Icon id='quote-right' fixedWidth /><FormattedMessage id='search_results.statuses' defaultMessage='Toots' /></h5> <h5><Icon id='quote-right' fixedWidth /><FormattedMessage id='search_results.statuses' defaultMessage='Toots' /></h5>
<div className='search-results__info'> <div className='search-results__info'>
@ -87,7 +87,7 @@ class SearchResults extends ImmutablePureComponent {
if (results.get('accounts') && results.get('accounts').size > 0) { if (results.get('accounts') && results.get('accounts').size > 0) {
count += results.get('accounts').size; count += results.get('accounts').size;
accounts = ( accounts = (
<section> <section className='search-results__section'>
<h5><Icon id='users' fixedWidth /><FormattedMessage id='search_results.accounts' defaultMessage='People' /></h5> <h5><Icon id='users' fixedWidth /><FormattedMessage id='search_results.accounts' defaultMessage='People' /></h5>
{results.get('accounts').map(accountId => <AccountContainer id={accountId} key={accountId} />)} {results.get('accounts').map(accountId => <AccountContainer id={accountId} key={accountId} />)}
@ -100,7 +100,7 @@ class SearchResults extends ImmutablePureComponent {
if (results.get('statuses') && results.get('statuses').size > 0) { if (results.get('statuses') && results.get('statuses').size > 0) {
count += results.get('statuses').size; count += results.get('statuses').size;
statuses = ( statuses = (
<section> <section className='search-results__section'>
<h5><Icon id='quote-right' fixedWidth /><FormattedMessage id='search_results.statuses' defaultMessage='Toots' /></h5> <h5><Icon id='quote-right' fixedWidth /><FormattedMessage id='search_results.statuses' defaultMessage='Toots' /></h5>
{results.get('statuses').map(statusId => <StatusContainer id={statusId} key={statusId}/>)} {results.get('statuses').map(statusId => <StatusContainer id={statusId} key={statusId}/>)}
@ -113,7 +113,7 @@ class SearchResults extends ImmutablePureComponent {
if (results.get('hashtags') && results.get('hashtags').size > 0) { if (results.get('hashtags') && results.get('hashtags').size > 0) {
count += results.get('hashtags').size; count += results.get('hashtags').size;
hashtags = ( hashtags = (
<section> <section className='search-results__section'>
<h5><Icon id='hashtag' fixedWidth /><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></h5> <h5><Icon id='hashtag' fixedWidth /><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></h5>
{results.get('hashtags').map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)} {results.get('hashtags').map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)}
@ -131,11 +131,9 @@ class SearchResults extends ImmutablePureComponent {
<FormattedMessage id='search_results.total' defaultMessage='{count, number} {count, plural, one {result} other {results}}' values={{ count }} /> <FormattedMessage id='search_results.total' defaultMessage='{count, number} {count, plural, one {result} other {results}}' values={{ count }} />
</header> </header>
<div className='search-results__contents'> {accounts}
{accounts} {statuses}
{statuses} {hashtags}
{hashtags}
</div>
</div> </div>
); );
}; };

View file

@ -120,20 +120,22 @@
} }
.drawer--results { .drawer--results {
background: $ui-base-color; overflow-x: hidden;
overflow: hidden; overflow-y: scroll;
display: flex; }
flex-direction: column;
flex: 1 1 auto;
& > header { .search-results__section {
color: $dark-text-color; margin-bottom: 5px;
background: lighten($ui-base-color, 2%);
h5 {
background: darken($ui-base-color, 4%);
border-bottom: 1px solid lighten($ui-base-color, 8%);
cursor: default;
display: flex;
padding: 15px; padding: 15px;
font-weight: 500; font-weight: 500;
font-size: 16px; font-size: 16px;
cursor: default; color: $dark-text-color;
flex: 0 0 auto;
.fa { .fa {
display: inline-block; display: inline-block;
@ -141,48 +143,22 @@
} }
} }
& > .search-results__contents { .account:last-child,
overflow-x: hidden; & > div:last-child .status {
overflow-y: scroll; border-bottom: 0;
flex: 1 1 auto; }
& > section { & > .hashtag {
margin-bottom: 5px; display: block;
padding: 10px;
color: $secondary-text-color;
text-decoration: none;
h5 { &:hover,
background: darken($ui-base-color, 4%); &:active,
border-bottom: 1px solid lighten($ui-base-color, 8%); &:focus {
cursor: default; color: lighten($secondary-text-color, 4%);
display: flex; text-decoration: underline;
padding: 15px;
font-weight: 500;
font-size: 16px;
color: $dark-text-color;
.fa {
display: inline-block;
margin-right: 5px;
}
}
.account:last-child,
& > div:last-child .status {
border-bottom: 0;
}
& > .hashtag {
display: block;
padding: 10px;
color: $secondary-text-color;
text-decoration: none;
&:hover,
&:active,
&:focus {
color: lighten($secondary-text-color, 4%);
text-decoration: underline;
}
}
} }
} }
} }

View file

@ -94,10 +94,15 @@
.search-results__header { .search-results__header {
color: $dark-text-color; color: $dark-text-color;
background: lighten($ui-base-color, 2%); background: lighten($ui-base-color, 2%);
border-bottom: 1px solid darken($ui-base-color, 4%); padding: 15px;
padding: 15px 10px;
font-size: 14px;
font-weight: 500; font-weight: 500;
font-size: 16px;
cursor: default;
.fa {
display: inline-block;
margin-right: 5px;
}
} }
.search-results__info { .search-results__info {