chore: file structure

This commit is contained in:
Ou 2024-10-01 13:12:06 +08:00
parent ab35e2383d
commit 5c94fa2a19
2 changed files with 7 additions and 8 deletions

View File

@ -17,7 +17,7 @@ export interface ItemsProps extends React.HTMLAttributes<HTMLDivElement> {
*/
isDragged?: boolean
isOverlay?: boolean
listeners?: SyntheticListenerMap
handleListeners?: SyntheticListenerMap
}
interface NewsCardProps {
@ -31,7 +31,7 @@ interface Query {
query: UseQueryResult<SourceInfo, Error>
}
export const CardWrapper = forwardRef<HTMLDivElement, ItemsProps>(({ id, isDragged, isOverlay, listeners, style, ...props }, dndRef) => {
export const CardWrapper = forwardRef<HTMLDivElement, ItemsProps>(({ id, isDragged, isOverlay, handleListeners, style, ...props }, dndRef) => {
const ref = useRef<HTMLDivElement>(null)
const { ref: inViewRef, inView } = useInView({
threshold: 0,
@ -48,14 +48,13 @@ export const CardWrapper = forwardRef<HTMLDivElement, ItemsProps>(({ id, isDragg
isDragged && "op-50",
isOverlay ? "bg-glass" : "",
)}
key={id}
style={{
transformOrigin: "50% 50%",
...style,
}}
{...props}
>
<NewsCard id={id} inView={inView} isOverlay={isOverlay} handleListeners={listeners} />
<NewsCard id={id} inView={inView} isOverlay={isOverlay} handleListeners={handleListeners} />
</div>
)
})

View File

@ -66,8 +66,7 @@ export function Dnd() {
)
}
function SortableCardWrapper(props: ItemsProps) {
const { id } = props
function SortableCardWrapper({ id, ...props }: ItemsProps) {
const {
isDragging,
attributes,
@ -79,15 +78,16 @@ function SortableCardWrapper(props: ItemsProps) {
const style = {
transform: CSS.Transform.toString(transform),
transition: transition || undefined,
transition,
}
return (
<CardWrapper
ref={setNodeRef}
id={id}
style={style}
isDragged={isDragging}
listeners={listeners}
handleListeners={listeners}
{...attributes}
{...props}
/>