Make sidebar photo count animation consistent

This commit is contained in:
Sam Becker 2023-10-21 13:55:22 -05:00
parent 2286b0f35b
commit eae78d2194
3 changed files with 24 additions and 21 deletions

View File

@ -1,6 +1,6 @@
'use client';
import { useRef } from 'react';
import { ReactNode, useRef } from 'react';
import { Variant, motion } from 'framer-motion';
import { useAppState } from '@/state';
@ -17,7 +17,7 @@ export interface AnimationConfig {
interface Props extends AnimationConfig {
className?: string
classNameItem?: string
items: JSX.Element[]
items: ReactNode[]
animateFromAppState?: boolean
animateOnFirstLoadOnly?: boolean
staggerOnFirstLoadOnly?: boolean

View File

@ -1,33 +1,37 @@
import { cc } from '@/utility/css';
import AnimateItems from './AnimateItems';
import { ReactNode } from 'react';
export default function HeaderList({
title,
icon,
items,
}: {
title: string,
title?: string,
icon?: JSX.Element,
items: JSX.Element[]
items: ReactNode[]
}) {
return (
<AnimateItems
scaleOffset={0.95}
duration={0.5}
staggerDelay={0.05}
items={[
<div key="header" className={cc(
'text-gray-900',
'dark:text-gray-100',
'flex items-center mb-0.5',
'uppercase',
)}>
{icon}
{icon && <>&nbsp;</>}
{title}
</div>,
].concat(items)}
classNameItem="text-dim"
items={(title || icon
? [
<div key="header" className={cc(
'text-gray-900',
'dark:text-gray-100',
'flex items-center mb-0.5',
'uppercase',
)}>
{icon}
{icon && title && <>&nbsp;</>}
{title}
</div>,
]
:[] as ReactNode[]
).concat(items)}
classNameItem="text-dim uppercase"
/>
);
}

View File

@ -38,10 +38,9 @@ export default function PhotoGridSidebar({
hideApple
/>)}
/>}
{photosCount > 0 &&
<div className="text-dim uppercase">
{photoQuantityText(photosCount, false)}
</div>}
{photosCount > 0 && <HeaderList
items={[photoQuantityText(photosCount, false)]}
/>}
</>
);
}