Fix ScrollableList class names regression

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-03-25 11:38:46 +01:00
parent f0f0da8bca
commit 7749f93c21
16 changed files with 21 additions and 16 deletions

View file

@ -71,6 +71,8 @@ interface IScrollableList extends VirtuosoProps<any, any> {
onRefresh?: () => Promise<any>; onRefresh?: () => Promise<any>;
/** Extra class names on the Virtuoso element. */ /** Extra class names on the Virtuoso element. */
className?: string; className?: string;
/** Extra class names on the list element. */
listClassName?: string;
/** Class names on each item container. */ /** Class names on each item container. */
itemClassName?: string; itemClassName?: string;
/** `id` attribute on the Virtuoso element. */ /** `id` attribute on the Virtuoso element. */
@ -96,6 +98,7 @@ const ScrollableList = React.forwardRef<VirtuosoHandle, IScrollableList>(({
onScrollToTop, onScrollToTop,
onLoadMore, onLoadMore,
className, className,
listClassName,
itemClassName, itemClassName,
id, id,
hasMore, hasMore,
@ -233,9 +236,10 @@ const ScrollableList = React.forwardRef<VirtuosoHandle, IScrollableList>(({
itemContent={renderItem} itemContent={renderItem}
initialTopMostItemIndex={initialIndex} initialTopMostItemIndex={initialIndex}
rangeChanged={handleRangeChange} rangeChanged={handleRangeChange}
className={className}
style={style} style={style}
context={{ context={{
listClassName: className, listClassName,
itemClassName, itemClassName,
}} }}
components={{ components={{

View file

@ -232,7 +232,7 @@ const StatusList: React.FC<IStatusList> = ({
placeholderComponent={() => <PlaceholderStatus variant={divideType === 'border' ? 'slim' : 'rounded'} />} placeholderComponent={() => <PlaceholderStatus variant={divideType === 'border' ? 'slim' : 'rounded'} />}
placeholderCount={20} placeholderCount={20}
ref={node} ref={node}
className={clsx('divide-y divide-solid divide-gray-200 dark:divide-gray-800', { listClassName={clsx('divide-y divide-solid divide-gray-200 dark:divide-gray-800', {
'divide-none': divideType !== 'border', 'divide-none': divideType !== 'border',
}, className)} }, className)}
itemClassName={clsx({ itemClassName={clsx({

View file

@ -56,7 +56,7 @@ const ModerationLog = () => {
emptyMessage={intl.formatMessage(messages.emptyMessage)} emptyMessage={intl.formatMessage(messages.emptyMessage)}
hasMore={hasMore} hasMore={hasMore}
onLoadMore={handleLoadMore} onLoadMore={handleLoadMore}
className='divide-y divide-solid divide-gray-200 dark:divide-gray-800' listClassName='divide-y divide-solid divide-gray-200 dark:divide-gray-800'
> >
{items.map(item => item && ( {items.map(item => item && (
<LogItem key={item.id} log={item} /> <LogItem key={item.id} log={item} />

View file

@ -33,7 +33,7 @@ const AwaitingApproval: React.FC = () => {
showLoading={showLoading} showLoading={showLoading}
scrollKey='awaiting-approval' scrollKey='awaiting-approval'
emptyMessage={intl.formatMessage(messages.emptyMessage)} emptyMessage={intl.formatMessage(messages.emptyMessage)}
className='divide-y divide-solid divide-gray-200 dark:divide-gray-800' listClassName='divide-y divide-solid divide-gray-200 dark:divide-gray-800'
> >
{accountIds.map(id => ( {accountIds.map(id => (
<div key={id} className='px-5 py-4'> <div key={id} className='px-5 py-4'>

View file

@ -35,7 +35,7 @@ const Reports: React.FC = () => {
showLoading={showLoading} showLoading={showLoading}
scrollKey='admin-reports' scrollKey='admin-reports'
emptyMessage={intl.formatMessage(messages.emptyMessage)} emptyMessage={intl.formatMessage(messages.emptyMessage)}
className='divide-y divide-solid divide-gray-200 dark:divide-gray-800' listClassName='divide-y divide-solid divide-gray-200 dark:divide-gray-800'
> >
{reports.map(report => report && <Report id={report} key={report} />)} {reports.map(report => report && <Report id={report} key={report} />)}
</ScrollableList> </ScrollableList>

View file

@ -45,7 +45,7 @@ const DomainBlocks: React.FC = () => {
onLoadMore={() => handleLoadMore(dispatch)} onLoadMore={() => handleLoadMore(dispatch)}
hasMore={hasMore} hasMore={hasMore}
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
className='divide-y divide-gray-200 dark:divide-gray-800' listClassName='divide-y divide-gray-200 dark:divide-gray-800'
> >
{domains.map((domain) => {domains.map((domain) =>
<Domain key={domain} domain={domain} />, <Domain key={domain} domain={domain} />,

View file

@ -35,7 +35,7 @@ const GroupTopics: React.FC<IGroupTopics> = (props) => {
showLoading={!group || isLoading && tags.length === 0} showLoading={!group || isLoading && tags.length === 0}
placeholderComponent={PlaceholderAccount} placeholderComponent={PlaceholderAccount}
placeholderCount={3} placeholderCount={3}
className='divide-y divide-solid divide-gray-300 dark:divide-gray-800' listClassName='divide-y divide-solid divide-gray-300 dark:divide-gray-800'
itemClassName='py-3 last:pb-0' itemClassName='py-3 last:pb-0'
emptyMessage={ emptyMessage={
<Stack space={4} className='pt-6' justifyContent='center' alignItems='center'> <Stack space={4} className='pt-6' justifyContent='center' alignItems='center'>

View file

@ -164,7 +164,7 @@ const Notifications = () => {
onLoadMore={handleLoadOlder} onLoadMore={handleLoadOlder}
onScrollToTop={handleScrollToTop} onScrollToTop={handleScrollToTop}
onScroll={handleScroll} onScroll={handleScroll}
className={clsx({ listClassName={clsx({
'divide-y divide-gray-200 black:divide-gray-800 dark:divide-primary-800 divide-solid': notifications.size > 0, 'divide-y divide-gray-200 black:divide-gray-800 dark:divide-primary-800 divide-solid': notifications.size > 0,
'space-y-2': notifications.size === 0, 'space-y-2': notifications.size === 0,
})} })}

View file

@ -445,7 +445,7 @@ const Thread = (props: IThread) => {
initialTopMostItemIndex={initialTopMostItemIndex} initialTopMostItemIndex={initialTopMostItemIndex}
useWindowScroll={useWindowScroll} useWindowScroll={useWindowScroll}
itemClassName={itemClassName} itemClassName={itemClassName}
className={ listClassName={
clsx({ clsx({
'h-full': !useWindowScroll, 'h-full': !useWindowScroll,
}) })

View file

@ -28,7 +28,7 @@ const BirthdaysModal = ({ onClose }: IBirthdaysModal) => {
<ScrollableList <ScrollableList
scrollKey='birthdays' scrollKey='birthdays'
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
className='max-w-full' listClassName='max-w-full'
itemClassName='pb-3' itemClassName='pb-3'
> >
{accountIds.map(id => {accountIds.map(id =>

View file

@ -40,7 +40,7 @@ const DislikesModal: React.FC<IDislikesModal> = ({ onClose, statusId }) => {
<ScrollableList <ScrollableList
scrollKey='dislikes' scrollKey='dislikes'
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
className='max-w-full' listClassName='max-w-full'
itemClassName='pb-3' itemClassName='pb-3'
> >
{accountIds.map(id => {accountIds.map(id =>

View file

@ -40,7 +40,7 @@ const EventParticipantsModal: React.FC<IEventParticipantsModal> = ({ onClose, st
<ScrollableList <ScrollableList
scrollKey='event_participations' scrollKey='event_participations'
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
className='max-w-full' listClassName='max-w-full'
itemClassName='pb-3' itemClassName='pb-3'
> >
{accountIds.map(id => {accountIds.map(id =>

View file

@ -47,7 +47,7 @@ const FavouritesModal: React.FC<IFavouritesModal> = ({ onClose, statusId }) => {
<ScrollableList <ScrollableList
scrollKey='favourites' scrollKey='favourites'
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
className='max-w-full' listClassName='max-w-full'
itemClassName='pb-3' itemClassName='pb-3'
style={{ height: '80vh' }} style={{ height: '80vh' }}
useWindowScroll={false} useWindowScroll={false}

View file

@ -41,7 +41,7 @@ const MentionsModal: React.FC<IMentionsModal> = ({ onClose, statusId }) => {
body = ( body = (
<ScrollableList <ScrollableList
scrollKey='mentions' scrollKey='mentions'
className='max-w-full' listClassName='max-w-full'
itemClassName='pb-3' itemClassName='pb-3'
> >
{accountIds.map(id => {accountIds.map(id =>

View file

@ -98,9 +98,10 @@ const ReactionsModal: React.FC<IReactionsModal> = ({ onClose, statusId, reaction
<ScrollableList <ScrollableList
scrollKey='reactions' scrollKey='reactions'
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
className={clsx('max-w-full', { className={clsx({
'mt-4': reactions.size > 0, 'mt-4': reactions.size > 0,
})} })}
listClassName='max-w-full'
itemClassName='pb-3' itemClassName='pb-3'
> >
{accounts.map((account) => {accounts.map((account) =>

View file

@ -48,7 +48,7 @@ const ReblogsModal: React.FC<IReblogsModal> = ({ onClose, statusId }) => {
<ScrollableList <ScrollableList
scrollKey='reblogs' scrollKey='reblogs'
emptyMessage={emptyMessage} emptyMessage={emptyMessage}
className='max-w-full' listClassName='max-w-full'
itemClassName='pb-3' itemClassName='pb-3'
style={{ height: '80vh' }} style={{ height: '80vh' }}
useWindowScroll={false} useWindowScroll={false}