pl-fe: migrate directory page to scss file
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -15,8 +15,6 @@ import StillImage from '@/components/still-image';
|
|||||||
import Avatar from '@/components/ui/avatar';
|
import Avatar from '@/components/ui/avatar';
|
||||||
import { CardTitle } from '@/components/ui/card';
|
import { CardTitle } from '@/components/ui/card';
|
||||||
import Column from '@/components/ui/column';
|
import Column from '@/components/ui/column';
|
||||||
import Stack from '@/components/ui/stack';
|
|
||||||
import Text from '@/components/ui/text';
|
|
||||||
import ActionButton from '@/features/ui/components/action-button';
|
import ActionButton from '@/features/ui/components/action-button';
|
||||||
import { directoryRoute } from '@/features/ui/router';
|
import { directoryRoute } from '@/features/ui/router';
|
||||||
import { useAppSelector } from '@/hooks/use-app-selector';
|
import { useAppSelector } from '@/hooks/use-app-selector';
|
||||||
@ -46,10 +44,10 @@ const AccountCard: React.FC<IAccountCard> = ({ id }) => {
|
|||||||
const followedBy = me !== account.id && account.relationship?.followed_by;
|
const followedBy = me !== account.id && account.relationship?.followed_by;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='flex flex-col divide-y divide-gray-200 rounded-lg bg-white text-center shadow dark:divide-primary-700 dark:bg-primary-800'>
|
<div className='⁂-directory-card'>
|
||||||
<div className='relative'>
|
<div className='⁂-directory-card__header'>
|
||||||
{followedBy && (
|
{followedBy && (
|
||||||
<div className='absolute left-2.5 top-2.5'>
|
<div className='⁂-directory-card__badge'>
|
||||||
<Badge
|
<Badge
|
||||||
slug='opaque'
|
slug='opaque'
|
||||||
title={<FormattedMessage id='account.follows_you' defaultMessage='Follows you' />}
|
title={<FormattedMessage id='account.follows_you' defaultMessage='Follows you' />}
|
||||||
@ -57,7 +55,7 @@ const AccountCard: React.FC<IAccountCard> = ({ id }) => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className='absolute bottom-0 right-3 z-[1] translate-y-1/2'>
|
<div className='⁂-directory-card__action'>
|
||||||
<ActionButton account={account} small />
|
<ActionButton account={account} small />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -66,10 +64,10 @@ const AccountCard: React.FC<IAccountCard> = ({ id }) => {
|
|||||||
src={account.header}
|
src={account.header}
|
||||||
staticSrc={account.header_static}
|
staticSrc={account.header_static}
|
||||||
alt={account.header_description}
|
alt={account.header_description}
|
||||||
className='block h-32 w-full rounded-t-lg object-cover'
|
className='⁂-directory-card__header__image'
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className='h-32 w-full rounded-t-lg bg-gray-200 dark:bg-gray-700' />
|
<div className='⁂-directory-card__header__image--empty' />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Link to='/@{$username}' params={{ username: account.acct }} title={account.acct}>
|
<Link to='/@{$username}' params={{ username: account.acct }} title={account.acct}>
|
||||||
@ -77,7 +75,7 @@ const AccountCard: React.FC<IAccountCard> = ({ id }) => {
|
|||||||
<Avatar
|
<Avatar
|
||||||
src={account.avatar}
|
src={account.avatar}
|
||||||
alt={account.avatar_description}
|
alt={account.avatar_description}
|
||||||
className='!absolute bottom-0 left-3 translate-y-1/2 bg-white ring-2 ring-white dark:bg-primary-900 dark:ring-primary-900'
|
className='⁂-directory-card__avatar'
|
||||||
size={64}
|
size={64}
|
||||||
isCat={account.is_cat}
|
isCat={account.is_cat}
|
||||||
username={account.username}
|
username={account.username}
|
||||||
@ -86,7 +84,7 @@ const AccountCard: React.FC<IAccountCard> = ({ id }) => {
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Stack space={4} className='p-3 pt-10'>
|
<div className='⁂-directory-card__account'>
|
||||||
<Account
|
<Account
|
||||||
account={account}
|
account={account}
|
||||||
withAvatar={false}
|
withAvatar={false}
|
||||||
@ -94,50 +92,42 @@ const AccountCard: React.FC<IAccountCard> = ({ id }) => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{!!account.note && (
|
{!!account.note && (
|
||||||
<Text
|
<p className='⁂-directory-card__bio'>
|
||||||
truncate
|
|
||||||
align='left'
|
|
||||||
className='line-clamp-2 inline text-ellipsis [&_br]:hidden [&_p:first-child]:inline [&_p:first-child]:truncate [&_p]:hidden'
|
|
||||||
>
|
|
||||||
<ParsedContent html={account.note} emojis={account.emojis} speakAsCat={account.speak_as_cat} />
|
<ParsedContent html={account.note} emojis={account.emojis} speakAsCat={account.speak_as_cat} />
|
||||||
</Text>
|
</p>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</div>
|
||||||
|
|
||||||
<div className='grid grid-cols-3 gap-1 py-4'>
|
<div className='⁂-directory-card__details'>
|
||||||
<Stack>
|
<div>
|
||||||
<Text theme='primary' size='md' weight='medium'>
|
<p>{shortNumberFormat(account.statuses_count)}</p>
|
||||||
{shortNumberFormat(account.statuses_count)}
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<Text theme='muted' size='sm'>
|
<p>
|
||||||
<FormattedMessage id='account.posts' defaultMessage='Posts' />
|
<FormattedMessage id='account.posts' defaultMessage='Posts' />
|
||||||
</Text>
|
</p>
|
||||||
</Stack>
|
</div>
|
||||||
|
|
||||||
<Stack>
|
<div>
|
||||||
<Text theme='primary' size='md' weight='medium'>
|
<p>{shortNumberFormat(account.followers_count)}</p>
|
||||||
{shortNumberFormat(account.followers_count)}
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<Text theme='muted' size='sm'>
|
<p>
|
||||||
<FormattedMessage id='account.followers' defaultMessage='Followers' />
|
<FormattedMessage id='account.followers' defaultMessage='Followers' />
|
||||||
</Text>
|
</p>
|
||||||
</Stack>
|
</div>
|
||||||
|
|
||||||
<Stack>
|
<div>
|
||||||
<Text theme='primary' size='md' weight='medium'>
|
<p>
|
||||||
{account.last_status_at ? (
|
{account.last_status_at ? (
|
||||||
<RelativeTimestamp theme='inherit' timestamp={account.last_status_at} />
|
<RelativeTimestamp theme='inherit' timestamp={account.last_status_at} />
|
||||||
) : (
|
) : (
|
||||||
<FormattedMessage id='account.never_active' defaultMessage='Never' />
|
<FormattedMessage id='account.never_active' defaultMessage='Never' />
|
||||||
)}
|
)}
|
||||||
</Text>
|
</p>
|
||||||
|
|
||||||
<Text theme='muted' size='sm'>
|
<p>
|
||||||
<FormattedMessage id='account.last_status' defaultMessage='Last active' />
|
<FormattedMessage id='account.last_status' defaultMessage='Last active' />
|
||||||
</Text>
|
</p>
|
||||||
</Stack>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -166,9 +156,9 @@ const DirectoryPage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Column label={intl.formatMessage(messages.title)}>
|
<Column label={intl.formatMessage(messages.title)}>
|
||||||
<Stack space={4}>
|
<div className='⁂-directory'>
|
||||||
<div className='grid grid-cols-1 gap-2 md:grid-cols-2'>
|
<div className='⁂-directory__filters'>
|
||||||
<Stack space={2}>
|
<div>
|
||||||
<CardTitle title={<FormattedMessage id='directory.display_filter' defaultMessage='Display filter' />} />
|
<CardTitle title={<FormattedMessage id='directory.display_filter' defaultMessage='Display filter' />} />
|
||||||
|
|
||||||
<RadioGroup onChange={handleChangeOrder}>
|
<RadioGroup onChange={handleChangeOrder}>
|
||||||
@ -183,10 +173,10 @@ const DirectoryPage = () => {
|
|||||||
value='new'
|
value='new'
|
||||||
/>
|
/>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</Stack>
|
</div>
|
||||||
|
|
||||||
{features.federating && (
|
{features.federating && (
|
||||||
<Stack space={2}>
|
<div>
|
||||||
<CardTitle title={<FormattedMessage id='directory.fediverse_filter' defaultMessage='Fediverse filter' />} />
|
<CardTitle title={<FormattedMessage id='directory.fediverse_filter' defaultMessage='Fediverse filter' />} />
|
||||||
|
|
||||||
<RadioGroup onChange={handleChangeLocal}>
|
<RadioGroup onChange={handleChangeLocal}>
|
||||||
@ -201,15 +191,15 @@ const DirectoryPage = () => {
|
|||||||
value='0'
|
value='0'
|
||||||
/>
|
/>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</Stack>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
clsx({
|
clsx({
|
||||||
'grid grid-cols-1 sm:grid-cols-2 gap-2.5': true,
|
'⁂-directory__cards': true,
|
||||||
'opacity-30': isLoading,
|
'⁂-directory__cards--loading': isLoading,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@ -219,7 +209,7 @@ const DirectoryPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{hasNextPage && <LoadMore onClick={handleLoadMore} disabled={isLoading} />}
|
{hasNextPage && <LoadMore onClick={handleLoadMore} disabled={isLoading} />}
|
||||||
</Stack>
|
</div>
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
123
packages/pl-fe/src/styles/new/directory.scss
Normal file
123
packages/pl-fe/src/styles/new/directory.scss
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
@use 'mixins';
|
||||||
|
@use 'variables';
|
||||||
|
|
||||||
|
.⁂-directory {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
|
||||||
|
&__filters {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
||||||
|
gap: 0.5rem;
|
||||||
|
|
||||||
|
@media (min-width: variables.$breakpoint-md) {
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
> div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__cards {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
||||||
|
gap: 0.625rem;
|
||||||
|
|
||||||
|
@media (min-width: variables.$breakpoint-sm) {
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
&--loading {
|
||||||
|
@apply animate-pulse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.⁂-directory-card {
|
||||||
|
overflow: clip;
|
||||||
|
@apply flex flex-col divide-y divide-gray-200 rounded-lg bg-white text-center shadow dark:divide-primary-700 dark:bg-primary-800;
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&__image {
|
||||||
|
@apply block h-32 w-full rounded-t-lg object-cover;
|
||||||
|
|
||||||
|
&--empty {
|
||||||
|
@apply bg-gray-200 dark:bg-primary-700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__badge {
|
||||||
|
position: absolute;
|
||||||
|
left: 0.625rem;
|
||||||
|
top: 0.625rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__action {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0.75rem;
|
||||||
|
z-index: 1;
|
||||||
|
transform: translateY(50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__avatar {
|
||||||
|
position: absolute !important;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0.75rem;
|
||||||
|
@apply translate-y-1/2 bg-white ring-2 ring-white dark:bg-primary-900 dark:ring-primary-900;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__account {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 2.5rem 0.75rem 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__bio {
|
||||||
|
@apply line-clamp-2 inline text-ellipsis;
|
||||||
|
@include mixins.text($truncate: true);
|
||||||
|
|
||||||
|
br {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
p:first-child {
|
||||||
|
display: inline;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__details {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
gap: 0.25rem;
|
||||||
|
padding: 1rem 0;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
p:first-child {
|
||||||
|
@include mixins.text($theme: primary, $size: sm, $weight: medium);
|
||||||
|
}
|
||||||
|
|
||||||
|
p:last-child {
|
||||||
|
@include mixins.text($theme: muted, $size: sm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,3 +8,4 @@
|
|||||||
@use 'drive';
|
@use 'drive';
|
||||||
@use 'chats';
|
@use 'chats';
|
||||||
@use 'events';
|
@use 'events';
|
||||||
|
@use 'directory';
|
||||||
|
|||||||
Reference in New Issue
Block a user