[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:
parent
b96c3ce008
commit
1ee541ebfb
@ -174,12 +174,17 @@ export const CollectionAdder: React.FC<{
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<NewCollectionButton onClick={handleNewCollection} />
|
<NewCollectionButton compact onClick={handleNewCollection} />
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div className={classes.newCollection}>
|
<div className={classes.newCollection}>
|
||||||
<NewCollectionButton onClick={handleNewCollection} />
|
<NewCollectionButton secondary onClick={handleNewCollection}>
|
||||||
|
<FormattedMessage
|
||||||
|
id='collections.create_new_collection'
|
||||||
|
defaultMessage='Create new collection'
|
||||||
|
/>
|
||||||
|
</NewCollectionButton>
|
||||||
</div>
|
</div>
|
||||||
{collections.map((item) => (
|
{collections.map((item) => (
|
||||||
<ListItem key={item.id} collection={item} account={account} />
|
<ListItem key={item.id} collection={item} account={account} />
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
.newCollection {
|
.newCollection {
|
||||||
display: flex;
|
padding: 16px;
|
||||||
justify-content: center;
|
|
||||||
padding-block: 16px;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
|
import type { ReactNode } from 'react';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
import classNames from 'classnames';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import AddIcon from '@/material-icons/400-24px/add.svg?react';
|
import AddIcon from '@/material-icons/400-24px/add.svg?react';
|
||||||
@ -29,16 +31,23 @@ import {
|
|||||||
} from '../editor';
|
} from '../editor';
|
||||||
import classes from '../styles.module.scss';
|
import classes from '../styles.module.scss';
|
||||||
|
|
||||||
export const NewCollectionButton: React.FC<{ onClick?: () => void }> = ({
|
export const NewCollectionButton: React.FC<{
|
||||||
onClick,
|
compact?: boolean;
|
||||||
}) => (
|
secondary?: boolean;
|
||||||
|
onClick?: () => void;
|
||||||
|
children?: ReactNode;
|
||||||
|
}> = ({ compact, secondary, onClick, children }) => (
|
||||||
<Link
|
<Link
|
||||||
to='/collections/new'
|
to='/collections/new'
|
||||||
className='button button--compact'
|
className={classNames(
|
||||||
|
'button',
|
||||||
|
compact && 'button--compact',
|
||||||
|
secondary && 'button-secondary',
|
||||||
|
)}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
<Icon id='plus' icon={AddIcon} />
|
<Icon id='plus' icon={AddIcon} />
|
||||||
<FormattedMessage {...editorMessages.newCollection} />
|
{children ?? <FormattedMessage {...editorMessages.newCollection} />}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -106,7 +115,7 @@ export const CollectionsCreatedByAccount: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<NewCollectionButton />
|
<NewCollectionButton compact />
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -138,7 +147,7 @@ export const CollectionsCreatedByAccount: React.FC = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</h2>
|
</h2>
|
||||||
{showCreateButton && <NewCollectionButton />}
|
{showCreateButton && <NewCollectionButton compact />}
|
||||||
</div>
|
</div>
|
||||||
<ItemList>
|
<ItemList>
|
||||||
{isOwnCollectionPage && !canCreateMoreCollections && (
|
{isOwnCollectionPage && !canCreateMoreCollections && (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user