From abe17172156920bcb4a850a480597ded401be6a1 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 10 Sep 2024 11:29:17 +0200 Subject: [PATCH] [Glitch] Change design of hide media button in web UI Port 3929e3c6d21226ad42f743a283576004d9c1c7eb to glitch-soc Signed-off-by: Claire --- .../glitch/components/media_gallery.jsx | 32 +++++----- .../flavours/glitch/styles/components.scss | 60 +++++++++++-------- 2 files changed, 50 insertions(+), 42 deletions(-) diff --git a/app/javascript/flavours/glitch/components/media_gallery.jsx b/app/javascript/flavours/glitch/components/media_gallery.jsx index 5c40e2b22f..1710ca9691 100644 --- a/app/javascript/flavours/glitch/components/media_gallery.jsx +++ b/app/javascript/flavours/glitch/components/media_gallery.jsx @@ -1,7 +1,7 @@ import PropTypes from 'prop-types'; import { PureComponent } from 'react'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; @@ -10,17 +10,10 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { debounce } from 'lodash'; -import VisibilityOffIcon from '@/material-icons/400-24px/visibility_off.svg?react'; import { Blurhash } from 'flavours/glitch/components/blurhash'; import { autoPlayGif, displayMedia, useBlurhash } from '../initial_state'; -import { IconButton } from './icon_button'; - -const messages = defineMessages({ - toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: '{number, plural, one {Hide image} other {Hide images}}' }, -}); - class Item extends PureComponent { static propTypes = { @@ -220,7 +213,6 @@ class MediaGallery extends PureComponent { lang: PropTypes.string, size: PropTypes.object, onOpenMedia: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, defaultWidth: PropTypes.number, cacheWidth: PropTypes.func, visible: PropTypes.bool, @@ -309,7 +301,7 @@ class MediaGallery extends PureComponent { } render () { - const { media, lang, intl, sensitive, letterbox, fullwidth, defaultWidth, autoplay } = this.props; + const { media, lang, sensitive, letterbox, fullwidth, defaultWidth, autoplay } = this.props; const { visible } = this.state; const size = media.size; const uncached = media.every(attachment => attachment.get('type') === 'unknown'); @@ -343,9 +335,7 @@ class MediaGallery extends PureComponent { ); - } else if (visible) { - spoilerButton = ; - } else { + } else if (!visible) { spoilerButton = ( + + )} ); } } -export default injectIntl(MediaGallery); +export default MediaGallery; diff --git a/app/javascript/flavours/glitch/styles/components.scss b/app/javascript/flavours/glitch/styles/components.scss index 51d87dbddf..70f950f3ca 100644 --- a/app/javascript/flavours/glitch/styles/components.scss +++ b/app/javascript/flavours/glitch/styles/components.scss @@ -5050,22 +5050,14 @@ a.status-card { position: absolute; z-index: 100; - &--minified { - display: block; - inset-inline-start: 4px; - top: 4px; - width: auto; - height: auto; + &--hidden { + display: none; } &--click-thru { pointer-events: none; } - &--hidden { - display: none; - } - &__overlay { display: flex; align-items: center; @@ -5077,19 +5069,20 @@ a.status-card { margin: 0; border: 0; color: $white; + line-height: 20px; + font-size: 14px; &__label { background-color: rgba($black, 0.45); backdrop-filter: blur(10px) saturate(180%) contrast(75%) brightness(70%); - border-radius: 6px; - padding: 10px 15px; + border-radius: 8px; + padding: 12px 16px; display: flex; align-items: center; justify-content: center; - gap: 8px; + gap: 4px; flex-direction: column; - font-weight: 500; - font-size: 14px; + font-weight: 600; } &__action { @@ -7336,10 +7329,32 @@ img.modal-warning { } } -.media-gallery__item__badges { +.media-gallery__actions { position: absolute; bottom: 6px; - inset-inline-start: 6px; + inset-inline-end: 6px; + display: flex; + gap: 2px; + z-index: 2; + + &__pill { + display: block; + color: $white; + border: 0; + background: rgba($black, 0.65); + backdrop-filter: blur(10px) saturate(180%) contrast(75%) brightness(70%); + padding: 3px 12px; + border-radius: 99px; + font-size: 14px; + font-weight: 700; + line-height: 20px; + } +} + +.media-gallery__item__badges { + position: absolute; + bottom: 8px; + inset-inline-start: 8px; display: flex; gap: 2px; } @@ -7352,18 +7367,13 @@ img.modal-warning { color: $white; background: rgba($black, 0.65); backdrop-filter: blur(10px) saturate(180%) contrast(75%) brightness(70%); - padding: 2px 6px; + padding: 3px 8px; border-radius: 4px; - font-size: 11px; + font-size: 12px; font-weight: 700; z-index: 1; pointer-events: none; - line-height: 18px; - - .icon { - width: 15px; - height: 15px; - } + line-height: 20px; } .attachment-list {