Make sidebar photo count animation consistent
This commit is contained in:
parent
2286b0f35b
commit
eae78d2194
@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useRef } from 'react';
|
import { ReactNode, useRef } from 'react';
|
||||||
import { Variant, motion } from 'framer-motion';
|
import { Variant, motion } from 'framer-motion';
|
||||||
import { useAppState } from '@/state';
|
import { useAppState } from '@/state';
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ export interface AnimationConfig {
|
|||||||
interface Props extends AnimationConfig {
|
interface Props extends AnimationConfig {
|
||||||
className?: string
|
className?: string
|
||||||
classNameItem?: string
|
classNameItem?: string
|
||||||
items: JSX.Element[]
|
items: ReactNode[]
|
||||||
animateFromAppState?: boolean
|
animateFromAppState?: boolean
|
||||||
animateOnFirstLoadOnly?: boolean
|
animateOnFirstLoadOnly?: boolean
|
||||||
staggerOnFirstLoadOnly?: boolean
|
staggerOnFirstLoadOnly?: boolean
|
||||||
|
|||||||
@ -1,33 +1,37 @@
|
|||||||
import { cc } from '@/utility/css';
|
import { cc } from '@/utility/css';
|
||||||
import AnimateItems from './AnimateItems';
|
import AnimateItems from './AnimateItems';
|
||||||
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
export default function HeaderList({
|
export default function HeaderList({
|
||||||
title,
|
title,
|
||||||
icon,
|
icon,
|
||||||
items,
|
items,
|
||||||
}: {
|
}: {
|
||||||
title: string,
|
title?: string,
|
||||||
icon?: JSX.Element,
|
icon?: JSX.Element,
|
||||||
items: JSX.Element[]
|
items: ReactNode[]
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<AnimateItems
|
<AnimateItems
|
||||||
scaleOffset={0.95}
|
scaleOffset={0.95}
|
||||||
duration={0.5}
|
duration={0.5}
|
||||||
staggerDelay={0.05}
|
staggerDelay={0.05}
|
||||||
items={[
|
items={(title || icon
|
||||||
<div key="header" className={cc(
|
? [
|
||||||
'text-gray-900',
|
<div key="header" className={cc(
|
||||||
'dark:text-gray-100',
|
'text-gray-900',
|
||||||
'flex items-center mb-0.5',
|
'dark:text-gray-100',
|
||||||
'uppercase',
|
'flex items-center mb-0.5',
|
||||||
)}>
|
'uppercase',
|
||||||
{icon}
|
)}>
|
||||||
{icon && <> </>}
|
{icon}
|
||||||
{title}
|
{icon && title && <> </>}
|
||||||
</div>,
|
{title}
|
||||||
].concat(items)}
|
</div>,
|
||||||
classNameItem="text-dim"
|
]
|
||||||
|
:[] as ReactNode[]
|
||||||
|
).concat(items)}
|
||||||
|
classNameItem="text-dim uppercase"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,10 +38,9 @@ export default function PhotoGridSidebar({
|
|||||||
hideApple
|
hideApple
|
||||||
/>)}
|
/>)}
|
||||||
/>}
|
/>}
|
||||||
{photosCount > 0 &&
|
{photosCount > 0 && <HeaderList
|
||||||
<div className="text-dim uppercase">
|
items={[photoQuantityText(photosCount, false)]}
|
||||||
{photoQuantityText(photosCount, false)}
|
/>}
|
||||||
</div>}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user