diff --git a/app/soapbox/features/ui/components/user_panel.js b/app/soapbox/features/ui/components/user_panel.js
index d434ff4cc..83dfd2099 100644
--- a/app/soapbox/features/ui/components/user_panel.js
+++ b/app/soapbox/features/ui/components/user_panel.js
@@ -9,7 +9,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import Avatar from 'soapbox/components/avatar';
import { shortNumberFormat } from 'soapbox/utils/numbers';
import { acctFull } from 'soapbox/utils/accounts';
-import { getSettings } from 'soapbox/actions/settings';
+import StillImage from 'soapbox/components/still_image';
class UserPanel extends ImmutablePureComponent {
@@ -20,7 +20,7 @@ class UserPanel extends ImmutablePureComponent {
}
render() {
- const { account, intl, domain, autoPlayGif } = this.props;
+ const { account, intl, domain } = this.props;
if (!account) return null;
const displayNameHtml = { __html: account.get('display_name_html') };
const acct = account.get('acct').indexOf('@') === -1 && domain ? `${account.get('acct')}@${domain}` : account.get('acct');
@@ -30,7 +30,7 @@ class UserPanel extends ImmutablePureComponent {
-
+
@@ -91,7 +91,6 @@ const mapStateToProps = state => {
return {
account: getAccount(state, me),
- autoPlayGif: getSettings(state).get('autoPlayGif'),
};
};
diff --git a/app/styles/accounts.scss b/app/styles/accounts.scss
index 02dec30f8..da3025186 100644
--- a/app/styles/accounts.scss
+++ b/app/styles/accounts.scss
@@ -24,7 +24,7 @@
background: var(--background-color);
border-radius: 4px 4px 0 0;
- img {
+ .still-image {
display: block;
width: 100%;
height: 100%;
@@ -61,7 +61,7 @@
height: 48px;
padding-top: 2px;
- img {
+ .still-image {
width: 100%;
height: 100%;
display: block;
diff --git a/app/styles/application.scss b/app/styles/application.scss
index 331e38f92..62682fc9c 100644
--- a/app/styles/application.scss
+++ b/app/styles/application.scss
@@ -58,6 +58,7 @@
@import 'components/navigation-bar';
@import 'components/promo-panel';
@import 'components/drawer';
+@import 'components/still-image';
@import 'components/timeline-queue-header';
@import 'components/badge';
@import 'components/trends';
diff --git a/app/styles/components/account-header.scss b/app/styles/components/account-header.scss
index 7fff5095d..78a9e7e78 100644
--- a/app/styles/components/account-header.scss
+++ b/app/styles/components/account-header.scss
@@ -21,7 +21,6 @@
background: var(--accent-color--med);
@media screen and (max-width: 895px) {height: 225px;}
&--none {height: 125px;}
-
img {
object-fit: cover;
display: block;
@@ -29,6 +28,23 @@
height: 100%;
margin: 0;
}
+
+ .still-image--play-on-hover::before {
+ content: 'GIF';
+ position: absolute;
+ color: var(--primary-text-color);
+ background: var(--foreground-color);
+ top: 6px;
+ left: 6px;
+ padding: 2px 6px;
+ border-radius: 2px;
+ font-size: 11px;
+ font-weight: 600;
+ pointer-events: none;
+ opacity: 0.9;
+ transition: opacity 0.1s ease;
+ line-height: 18px;
+ }
}
&__bar {
@@ -58,6 +74,23 @@
background-size: 200px 200px;
}
+ .still-image--play-on-hover::before {
+ content: 'GIF';
+ position: absolute;
+ color: var(--primary-text-color);
+ background: var(--foreground-color);
+ bottom: 15%;
+ left: 15%;
+ padding: 1px 4px;
+ border-radius: 2px;
+ font-size: 8px;
+ font-weight: 600;
+ pointer-events: none;
+ opacity: 0.9;
+ transition: opacity 0.1s ease;
+ line-height: 13px;
+ }
+
@media screen and (max-width: 895px) {
top: -45px;
left: 10px;
diff --git a/app/styles/components/media-gallery.scss b/app/styles/components/media-gallery.scss
index 05ba65a41..431610bb6 100644
--- a/app/styles/components/media-gallery.scss
+++ b/app/styles/components/media-gallery.scss
@@ -28,47 +28,26 @@
z-index: 1;
&,
- img,
- canvas {
+ .still-image {
height: 100%;
width: 100%;
}
- img,
- canvas {
- object-fit: cover;
- }
-
- &--play-on-hover {
- &::before {
- content: 'GIF';
- position: absolute;
- color: var(--primary-text-color);
- background: var(--foreground-color);
- bottom: 6px;
- left: 6px;
- padding: 2px 6px;
- border-radius: 2px;
- font-size: 11px;
- font-weight: 600;
- pointer-events: none;
- opacity: 0.9;
- transition: opacity 0.1s ease;
- line-height: 18px;
- }
-
- img {
- position: absolute;
- }
-
- img,
- &:hover::before {
- visibility: hidden;
- }
-
- &:hover img {
- visibility: visible;
- }
+ .still-image--play-on-hover::before {
+ content: 'GIF';
+ position: absolute;
+ color: var(--primary-text-color);
+ background: var(--foreground-color);
+ bottom: 6px;
+ left: 6px;
+ padding: 2px 6px;
+ border-radius: 2px;
+ font-size: 11px;
+ font-weight: 600;
+ pointer-events: none;
+ opacity: 0.9;
+ transition: opacity 0.1s ease;
+ line-height: 18px;
}
}
@@ -82,6 +61,23 @@
z-index: 0;
background: var(--background-color);
+ .still-image--play-on-hover::before {
+ content: 'GIF';
+ position: absolute;
+ color: var(--primary-text-color);
+ background: var(--foreground-color);
+ bottom: 6px;
+ left: 6px;
+ padding: 2px 6px;
+ border-radius: 2px;
+ font-size: 11px;
+ font-weight: 600;
+ pointer-events: none;
+ opacity: 0.9;
+ transition: opacity 0.1s ease;
+ line-height: 18px;
+ }
+
&--hidden {
display: none;
}
diff --git a/app/styles/components/still-image.scss b/app/styles/components/still-image.scss
new file mode 100644
index 000000000..0b86d6ada
--- /dev/null
+++ b/app/styles/components/still-image.scss
@@ -0,0 +1,28 @@
+.still-image {
+ position: relative;
+ overflow: hidden;
+
+ img,
+ canvas {
+ width: 100%;
+ height: 100%;
+ display: block;
+ object-fit: cover;
+ font-family: inherit;
+ }
+
+ &--play-on-hover {
+ img {
+ position: absolute;
+ visibility: hidden;
+ }
+
+ &:hover img {
+ visibility: visible;
+ }
+
+ &:hover canvas {
+ visibility: hidden;
+ }
+ }
+}