fix: Fix various UI text wrapping and overflow issues (#34774)
This commit is contained in:
parent
02ac18da51
commit
5dda094daa
5 changed files with 60 additions and 34 deletions
|
@ -7,10 +7,16 @@ import classNames from 'classnames';
|
||||||
|
|
||||||
export const AvatarGroup: React.FC<{
|
export const AvatarGroup: React.FC<{
|
||||||
compact?: boolean;
|
compact?: boolean;
|
||||||
|
avatarHeight?: number;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}> = ({ children, compact = false }) => (
|
}> = ({ children, compact = false, avatarHeight }) => (
|
||||||
<div
|
<div
|
||||||
className={classNames('avatar-group', { 'avatar-group--compact': compact })}
|
className={classNames('avatar-group', { 'avatar-group--compact': compact })}
|
||||||
|
style={
|
||||||
|
avatarHeight
|
||||||
|
? ({ '--avatar-height': `${avatarHeight}px` } as React.CSSProperties)
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
import { FormattedMessage } from 'react-intl';
|
|
||||||
|
|
||||||
import { IconLogo } from 'mastodon/components/logo';
|
|
||||||
import { AuthorLink } from 'mastodon/features/explore/components/author_link';
|
|
||||||
|
|
||||||
export const MoreFromAuthor = ({ accountId }) => (
|
|
||||||
<div className='more-from-author'>
|
|
||||||
<IconLogo />
|
|
||||||
<FormattedMessage id='link_preview.more_from_author' defaultMessage='More from {name}' values={{ name: <AuthorLink accountId={accountId} /> }} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
MoreFromAuthor.propTypes = {
|
|
||||||
accountId: PropTypes.string.isRequired,
|
|
||||||
};
|
|
21
app/javascript/mastodon/components/more_from_author.tsx
Normal file
21
app/javascript/mastodon/components/more_from_author.tsx
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
import { IconLogo } from 'mastodon/components/logo';
|
||||||
|
import { AuthorLink } from 'mastodon/features/explore/components/author_link';
|
||||||
|
|
||||||
|
export const MoreFromAuthor: React.FC<{ accountId: string }> = ({
|
||||||
|
accountId,
|
||||||
|
}) => (
|
||||||
|
<FormattedMessage
|
||||||
|
id='link_preview.more_from_author'
|
||||||
|
defaultMessage='More from {name}'
|
||||||
|
values={{ name: <AuthorLink accountId={accountId} /> }}
|
||||||
|
>
|
||||||
|
{(chunks) => (
|
||||||
|
<div className='more-from-author'>
|
||||||
|
<IconLogo />
|
||||||
|
{chunks}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</FormattedMessage>
|
||||||
|
);
|
|
@ -18,12 +18,14 @@ import { useAppSelector, useAppDispatch } from 'mastodon/store';
|
||||||
import { DisplayedName } from './displayed_name';
|
import { DisplayedName } from './displayed_name';
|
||||||
import { EmbeddedStatus } from './embedded_status';
|
import { EmbeddedStatus } from './embedded_status';
|
||||||
|
|
||||||
|
const AVATAR_SIZE = 28;
|
||||||
|
|
||||||
export const AvatarById: React.FC<{ accountId: string }> = ({ accountId }) => {
|
export const AvatarById: React.FC<{ accountId: string }> = ({ accountId }) => {
|
||||||
const account = useAppSelector((state) => state.accounts.get(accountId));
|
const account = useAppSelector((state) => state.accounts.get(accountId));
|
||||||
|
|
||||||
if (!account) return null;
|
if (!account) return null;
|
||||||
|
|
||||||
return <Avatar withLink account={account} size={28} />;
|
return <Avatar withLink account={account} size={AVATAR_SIZE} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type LabelRenderer = (
|
export type LabelRenderer = (
|
||||||
|
@ -108,7 +110,7 @@ export const NotificationGroupWithStatus: React.FC<{
|
||||||
<div className='notification-group__main'>
|
<div className='notification-group__main'>
|
||||||
<div className='notification-group__main__header'>
|
<div className='notification-group__main__header'>
|
||||||
<div className='notification-group__main__header__wrapper'>
|
<div className='notification-group__main__header__wrapper'>
|
||||||
<AvatarGroup>
|
<AvatarGroup avatarHeight={AVATAR_SIZE}>
|
||||||
{accountIds
|
{accountIds
|
||||||
.slice(0, NOTIFICATIONS_GROUP_MAX_AVATARS)
|
.slice(0, NOTIFICATIONS_GROUP_MAX_AVATARS)
|
||||||
.map((id) => (
|
.map((id) => (
|
||||||
|
@ -123,7 +125,14 @@ export const NotificationGroupWithStatus: React.FC<{
|
||||||
|
|
||||||
<div className='notification-group__main__header__label'>
|
<div className='notification-group__main__header__label'>
|
||||||
{label}
|
{label}
|
||||||
{timestamp && <RelativeTimestamp timestamp={timestamp} />}
|
{timestamp && (
|
||||||
|
<>
|
||||||
|
<span className='notification-group__main__header__label-separator'>
|
||||||
|
·
|
||||||
|
</span>
|
||||||
|
<RelativeTimestamp timestamp={timestamp} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -2253,14 +2253,18 @@ a .account__avatar {
|
||||||
|
|
||||||
.avatar-group {
|
.avatar-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 8px;
|
|
||||||
flex-wrap: wrap;
|
--avatar-height: 28px;
|
||||||
|
|
||||||
|
&:not(.avatar-group--compact) {
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
height: var(--avatar-height);
|
||||||
|
overflow-y: clip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-group--compact {
|
.avatar-group--compact {
|
||||||
gap: 0;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
|
|
||||||
& > :not(:first-child) {
|
& > :not(:first-child) {
|
||||||
margin-inline-start: -12px;
|
margin-inline-start: -12px;
|
||||||
}
|
}
|
||||||
|
@ -10412,7 +10416,8 @@ noscript {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
flex-wrap: wrap;
|
||||||
|
gap: 4px 8px;
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
|
@ -10506,12 +10511,6 @@ noscript {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
container-type: inline-size;
|
container-type: inline-size;
|
||||||
|
|
||||||
@container (width < 350px) {
|
|
||||||
&__header time {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__header {
|
&__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
@ -10524,7 +10523,8 @@ noscript {
|
||||||
|
|
||||||
&__label {
|
&__label {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 8px;
|
flex-wrap: wrap;
|
||||||
|
gap: 2px 8px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
color: $darker-text-color;
|
color: $darker-text-color;
|
||||||
|
@ -10542,6 +10542,13 @@ noscript {
|
||||||
time {
|
time {
|
||||||
color: $dark-text-color;
|
color: $dark-text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@container (width < 350px) {
|
||||||
|
time,
|
||||||
|
&-separator {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue