[Glitch] Change design of "New collection" button in "Add to collection" dialog

Port b55b426dfb5471ec4601279a44f3ed4471d69cda to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
diondiondion 2026-08-12 11:37:32 +02:00 committed by Tarrien
parent b96c3ce008
commit 1ee541ebfb
3 changed files with 24 additions and 12 deletions

View File

@ -174,12 +174,17 @@ export const CollectionAdder: React.FC<{
/>
}
>
<NewCollectionButton onClick={handleNewCollection} />
<NewCollectionButton compact onClick={handleNewCollection} />
</EmptyState>
) : (
<>
<div className={classes.newCollection}>
<NewCollectionButton onClick={handleNewCollection} />
<NewCollectionButton secondary onClick={handleNewCollection}>
<FormattedMessage
id='collections.create_new_collection'
defaultMessage='Create new collection'
/>
</NewCollectionButton>
</div>
{collections.map((item) => (
<ListItem key={item.id} collection={item} account={account} />

View File

@ -1,5 +1,3 @@
.newCollection {
display: flex;
justify-content: center;
padding-block: 16px;
padding: 16px;
}

View File

@ -1,7 +1,9 @@
import type { ReactNode } from 'react';
import { useEffect } from 'react';
import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import { Link } from 'react-router-dom';
import AddIcon from '@/material-icons/400-24px/add.svg?react';
@ -29,16 +31,23 @@ import {
} from '../editor';
import classes from '../styles.module.scss';
export const NewCollectionButton: React.FC<{ onClick?: () => void }> = ({
onClick,
}) => (
export const NewCollectionButton: React.FC<{
compact?: boolean;
secondary?: boolean;
onClick?: () => void;
children?: ReactNode;
}> = ({ compact, secondary, onClick, children }) => (
<Link
to='/collections/new'
className='button button--compact'
className={classNames(
'button',
compact && 'button--compact',
secondary && 'button-secondary',
)}
onClick={onClick}
>
<Icon id='plus' icon={AddIcon} />
<FormattedMessage {...editorMessages.newCollection} />
{children ?? <FormattedMessage {...editorMessages.newCollection} />}
</Link>
);
@ -106,7 +115,7 @@ export const CollectionsCreatedByAccount: React.FC = () => {
/>
}
>
<NewCollectionButton />
<NewCollectionButton compact />
</EmptyState>
);
} else {
@ -138,7 +147,7 @@ export const CollectionsCreatedByAccount: React.FC = () => {
}}
/>
</h2>
{showCreateButton && <NewCollectionButton />}
{showCreateButton && <NewCollectionButton compact />}
</div>
<ItemList>
{isOwnCollectionPage && !canCreateMoreCollections && (