Move "core" folder out of "features" into "base"
This commit is contained in:
41
src/base/components/lists/cards/ListCardAvatar.tsx
Normal file
41
src/base/components/lists/cards/ListCardAvatar.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) Contributors to the Suwayomi project
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import Avatar, { AvatarProps } from '@mui/material/Avatar';
|
||||
import { SpinnerImage, SpinnerImageProps } from '@/base/components/SpinnerImage.tsx';
|
||||
|
||||
export const ListCardAvatar = ({
|
||||
iconUrl,
|
||||
alt,
|
||||
slots,
|
||||
}: {
|
||||
iconUrl: string;
|
||||
alt: string;
|
||||
slots?: { avatarProps?: Partial<AvatarProps>; spinnerImageProps?: Partial<SpinnerImageProps> };
|
||||
}) => (
|
||||
<Avatar
|
||||
variant="rounded"
|
||||
alt={alt}
|
||||
{...slots?.avatarProps}
|
||||
sx={{
|
||||
width: 56,
|
||||
height: 56,
|
||||
flex: '0 0 auto',
|
||||
background: 'transparent',
|
||||
...slots?.avatarProps?.sx,
|
||||
}}
|
||||
>
|
||||
<SpinnerImage
|
||||
alt={alt}
|
||||
src={iconUrl}
|
||||
{...slots?.spinnerImageProps}
|
||||
spinnerStyle={{ small: true, ...slots?.spinnerImageProps?.spinnerStyle }}
|
||||
imgStyle={{ objectFit: 'cover', width: '100%', height: '100%', ...slots?.spinnerImageProps?.imgStyle }}
|
||||
/>
|
||||
</Avatar>
|
||||
);
|
||||
27
src/base/components/lists/cards/ListCardContent.tsx
Normal file
27
src/base/components/lists/cards/ListCardContent.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) Contributors to the Suwayomi project
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import CardContent, { CardContentProps } from '@mui/material/CardContent';
|
||||
|
||||
export const ListCardContent = ({ children, ...props }: CardContentProps) => (
|
||||
<CardContent
|
||||
{...props}
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 1,
|
||||
p: 1,
|
||||
'&:last-child': {
|
||||
paddingBottom: 1,
|
||||
},
|
||||
...props.sx,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</CardContent>
|
||||
);
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) Contributors to the Suwayomi project
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { Link } from 'react-router-dom';
|
||||
import CardActionArea from '@mui/material/CardActionArea';
|
||||
import { ComponentProps } from 'react';
|
||||
|
||||
export const OptionalCardActionAreaLink = ({
|
||||
disabled,
|
||||
children,
|
||||
...props
|
||||
}: ComponentProps<typeof CardActionArea> & ComponentProps<typeof Link> & { disabled?: boolean }) => {
|
||||
if (disabled) {
|
||||
return children;
|
||||
}
|
||||
|
||||
return (
|
||||
<CardActionArea component={Link} {...props}>
|
||||
{children}
|
||||
</CardActionArea>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user