mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
handle conditional item card expansion
This commit is contained in:
@@ -22,6 +22,7 @@ import { Play } from '/@/shared/types/types';
|
|||||||
|
|
||||||
interface ItemCardControlsProps {
|
interface ItemCardControlsProps {
|
||||||
controls?: ItemControls;
|
controls?: ItemControls;
|
||||||
|
enableExpansion?: boolean;
|
||||||
internalState?: ItemListStateActions;
|
internalState?: ItemListStateActions;
|
||||||
item: Album | AlbumArtist | Artist | Playlist | Song | undefined;
|
item: Album | AlbumArtist | Artist | Playlist | Song | undefined;
|
||||||
itemType: LibraryItem;
|
itemType: LibraryItem;
|
||||||
@@ -51,6 +52,7 @@ const containerProps = {
|
|||||||
|
|
||||||
export const ItemCardControls = ({
|
export const ItemCardControls = ({
|
||||||
controls,
|
controls,
|
||||||
|
enableExpansion,
|
||||||
internalState,
|
internalState,
|
||||||
item,
|
item,
|
||||||
itemType,
|
itemType,
|
||||||
@@ -198,7 +200,7 @@ export const ItemCardControls = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{controls?.onExpand && (
|
{controls?.onExpand && enableExpansion && (
|
||||||
<SecondaryButton
|
<SecondaryButton
|
||||||
className={styles.expand}
|
className={styles.expand}
|
||||||
icon="arrowDownS"
|
icon="arrowDownS"
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export interface ItemCardProps {
|
|||||||
controls?: ItemControls;
|
controls?: ItemControls;
|
||||||
data: Album | AlbumArtist | Artist | Playlist | Song | undefined;
|
data: Album | AlbumArtist | Artist | Playlist | Song | undefined;
|
||||||
enableDrag?: boolean;
|
enableDrag?: boolean;
|
||||||
|
enableExpansion?: boolean;
|
||||||
internalState?: ItemListStateActions;
|
internalState?: ItemListStateActions;
|
||||||
isRound?: boolean;
|
isRound?: boolean;
|
||||||
itemType: LibraryItem;
|
itemType: LibraryItem;
|
||||||
@@ -52,6 +53,7 @@ export const ItemCard = ({
|
|||||||
controls,
|
controls,
|
||||||
data,
|
data,
|
||||||
enableDrag,
|
enableDrag,
|
||||||
|
enableExpansion,
|
||||||
internalState,
|
internalState,
|
||||||
isRound,
|
isRound,
|
||||||
itemType,
|
itemType,
|
||||||
@@ -70,6 +72,7 @@ export const ItemCard = ({
|
|||||||
controls={controls}
|
controls={controls}
|
||||||
data={data}
|
data={data}
|
||||||
enableDrag={enableDrag}
|
enableDrag={enableDrag}
|
||||||
|
enableExpansion={enableExpansion}
|
||||||
imageUrl={imageUrl}
|
imageUrl={imageUrl}
|
||||||
internalState={internalState}
|
internalState={internalState}
|
||||||
isRound={isRound}
|
isRound={isRound}
|
||||||
@@ -84,6 +87,7 @@ export const ItemCard = ({
|
|||||||
controls={controls}
|
controls={controls}
|
||||||
data={data}
|
data={data}
|
||||||
enableDrag={enableDrag}
|
enableDrag={enableDrag}
|
||||||
|
enableExpansion={enableExpansion}
|
||||||
imageUrl={imageUrl}
|
imageUrl={imageUrl}
|
||||||
internalState={internalState}
|
internalState={internalState}
|
||||||
isRound={isRound}
|
isRound={isRound}
|
||||||
@@ -99,6 +103,7 @@ export const ItemCard = ({
|
|||||||
controls={controls}
|
controls={controls}
|
||||||
data={data}
|
data={data}
|
||||||
enableDrag={enableDrag}
|
enableDrag={enableDrag}
|
||||||
|
enableExpansion={enableExpansion}
|
||||||
imageUrl={imageUrl}
|
imageUrl={imageUrl}
|
||||||
internalState={internalState}
|
internalState={internalState}
|
||||||
isRound={isRound}
|
isRound={isRound}
|
||||||
@@ -112,6 +117,7 @@ export const ItemCard = ({
|
|||||||
|
|
||||||
export interface ItemCardDerivativeProps extends Omit<ItemCardProps, 'type'> {
|
export interface ItemCardDerivativeProps extends Omit<ItemCardProps, 'type'> {
|
||||||
controls?: ItemControls;
|
controls?: ItemControls;
|
||||||
|
enableExpansion?: boolean;
|
||||||
imageUrl: string | undefined;
|
imageUrl: string | undefined;
|
||||||
internalState?: ItemListStateActions;
|
internalState?: ItemListStateActions;
|
||||||
rows: DataRow[];
|
rows: DataRow[];
|
||||||
@@ -120,6 +126,7 @@ export interface ItemCardDerivativeProps extends Omit<ItemCardProps, 'type'> {
|
|||||||
const CompactItemCard = ({
|
const CompactItemCard = ({
|
||||||
controls,
|
controls,
|
||||||
data,
|
data,
|
||||||
|
enableExpansion,
|
||||||
imageUrl,
|
imageUrl,
|
||||||
internalState,
|
internalState,
|
||||||
isRound,
|
isRound,
|
||||||
@@ -232,6 +239,7 @@ const CompactItemCard = ({
|
|||||||
{withControls && showControls && (
|
{withControls && showControls && (
|
||||||
<ItemCardControls
|
<ItemCardControls
|
||||||
controls={controls}
|
controls={controls}
|
||||||
|
enableExpansion={enableExpansion}
|
||||||
item={data}
|
item={data}
|
||||||
itemType={itemType}
|
itemType={itemType}
|
||||||
type="compact"
|
type="compact"
|
||||||
@@ -320,6 +328,7 @@ const CompactItemCard = ({
|
|||||||
const DefaultItemCard = ({
|
const DefaultItemCard = ({
|
||||||
controls,
|
controls,
|
||||||
data,
|
data,
|
||||||
|
enableExpansion,
|
||||||
imageUrl,
|
imageUrl,
|
||||||
internalState,
|
internalState,
|
||||||
isRound,
|
isRound,
|
||||||
@@ -432,6 +441,7 @@ const DefaultItemCard = ({
|
|||||||
{withControls && showControls && (
|
{withControls && showControls && (
|
||||||
<ItemCardControls
|
<ItemCardControls
|
||||||
controls={controls}
|
controls={controls}
|
||||||
|
enableExpansion={enableExpansion}
|
||||||
item={data}
|
item={data}
|
||||||
itemType={itemType}
|
itemType={itemType}
|
||||||
type="default"
|
type="default"
|
||||||
@@ -520,6 +530,7 @@ const PosterItemCard = ({
|
|||||||
controls,
|
controls,
|
||||||
data,
|
data,
|
||||||
enableDrag,
|
enableDrag,
|
||||||
|
enableExpansion,
|
||||||
imageUrl,
|
imageUrl,
|
||||||
internalState,
|
internalState,
|
||||||
isRound,
|
isRound,
|
||||||
@@ -677,6 +688,7 @@ const PosterItemCard = ({
|
|||||||
{withControls && showControls && data && (
|
{withControls && showControls && data && (
|
||||||
<ItemCardControls
|
<ItemCardControls
|
||||||
controls={controls}
|
controls={controls}
|
||||||
|
enableExpansion={enableExpansion}
|
||||||
internalState={internalState}
|
internalState={internalState}
|
||||||
item={data}
|
item={data}
|
||||||
itemType={itemType}
|
itemType={itemType}
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ export interface ItemGridListProps {
|
|||||||
export const ItemGridList = ({
|
export const ItemGridList = ({
|
||||||
data,
|
data,
|
||||||
enableDrag = true,
|
enableDrag = true,
|
||||||
enableExpansion = true,
|
enableExpansion = false,
|
||||||
enableSelection = true,
|
enableSelection = true,
|
||||||
gap = 'sm',
|
gap = 'sm',
|
||||||
getRowId,
|
getRowId,
|
||||||
@@ -690,6 +690,7 @@ const ListComponent = memo((props: ListChildComponentProps<GridItemProps>) => {
|
|||||||
controls={controls}
|
controls={controls}
|
||||||
data={data[i]}
|
data={data[i]}
|
||||||
enableDrag={enableDrag}
|
enableDrag={enableDrag}
|
||||||
|
enableExpansion={props.data.enableExpansion}
|
||||||
internalState={props.data.internalState}
|
internalState={props.data.internalState}
|
||||||
itemType={itemType}
|
itemType={itemType}
|
||||||
rows={rows}
|
rows={rows}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export const AlbumListInfiniteGrid = forwardRef<any, AlbumListInfiniteGridProps>
|
|||||||
return (
|
return (
|
||||||
<ItemGridList
|
<ItemGridList
|
||||||
data={data}
|
data={data}
|
||||||
|
enableExpansion
|
||||||
gap={gap}
|
gap={gap}
|
||||||
initialTop={{
|
initialTop={{
|
||||||
to: scrollOffset ?? 0,
|
to: scrollOffset ?? 0,
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ export const AlbumListPaginatedGrid = forwardRef<any, AlbumListPaginatedGridProp
|
|||||||
<ItemGridList
|
<ItemGridList
|
||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
data={data || []}
|
data={data || []}
|
||||||
|
enableExpansion
|
||||||
gap={gap}
|
gap={gap}
|
||||||
initialTop={{
|
initialTop={{
|
||||||
to: scrollOffset ?? 0,
|
to: scrollOffset ?? 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user