Skip to content

Commit

Permalink
Add a clearer visual indicator when a post is collapsed (glitch-soc#15)
Browse files Browse the repository at this point in the history
Closes glitch-soc#10

Co-authored-by: dean <[email protected]>
  • Loading branch information
neatchee and deanveloper authored Dec 30, 2022
1 parent 5561834 commit 856997e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/javascript/flavours/glitch/components/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ class Status extends ImmutablePureComponent {
pictureInPicture,
...other
} = this.props;
const { isCollapsed, forceFilter } = this.state;
const { isCollapsed } = this.state;
let background = null;
let attachments = null;

Expand Down Expand Up @@ -796,6 +796,7 @@ class Status extends ImmutablePureComponent {
extraMedia={extraMedia}
mediaIcons={contentMediaIcons}
expanded={isExpanded}
collapsed={isCollapsed}
onExpandedToggle={this.handleExpandedToggle}
onTranslate={this.handleTranslate}
parseClick={parseClick}
Expand Down
12 changes: 12 additions & 0 deletions app/javascript/flavours/glitch/components/status_content.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ class StatusContent extends React.PureComponent {
status,
media,
extraMedia,
collapsed,
mediaIcons,
parseClick,
disabled,
Expand All @@ -329,6 +330,14 @@ class StatusContent extends React.PureComponent {
<TranslateButton onClick={this.handleTranslate} translation={status.get('translation')} />
);

const collapsedIndicator = collapsed && (
<div className='status__content--uncollapse-msg'>
<span className='status__content--uncollapse-msg-arrow' aria-hidden>⬇⬇</span>
<FormattedMessage id='status.uncollapse' defaultMessage='Uncollapse' />
<span className='status__content--uncollapse-msg-arrow' aria-hidden>⬇⬇</span>
</div>
);

if (status.get('spoiler_text').length > 0) {
let mentionsPlaceholder = '';

Expand Down Expand Up @@ -409,6 +418,7 @@ class StatusContent extends React.PureComponent {
</div>

{extraMedia}
{collapsedIndicator}
</div>
);
} else if (parseClick) {
Expand All @@ -432,6 +442,7 @@ class StatusContent extends React.PureComponent {
{translateButton}
{media}
{extraMedia}
{collapsedIndicator}
</div>
);
} else {
Expand All @@ -453,6 +464,7 @@ class StatusContent extends React.PureComponent {
{translateButton}
{media}
{extraMedia}
{collapsedIndicator}
</div>
);
}
Expand Down
17 changes: 16 additions & 1 deletion app/javascript/flavours/glitch/styles/components/status.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

.status__content {
position: relative;
margin: 10px 0;
margin: 20px 0;
font-size: 15px;
line-height: 20px;
word-wrap: break-word;
Expand Down Expand Up @@ -214,6 +214,20 @@
text-decoration: none;
}
}

.status__content--uncollapse-msg {
position: absolute;
bottom: 0;
text-align: center;
z-index: 1;
width: 100%;
color: $light-text-color;
background: linear-gradient(90deg, rgba($ui-base-color,0), rgba($ui-base-color,1) 40% 60%, rgba($ui-base-color,0));

.status__content--uncollapse-msg-arrow {
margin: 0 10px;
}
}
}

.translate-button {
Expand Down Expand Up @@ -406,6 +420,7 @@
overflow: hidden;
text-overflow: ellipsis;
padding-top: 0;
margin-bottom: 5px;

&:after {
content: "";
Expand Down

0 comments on commit 856997e

Please sign in to comment.