mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-21 13:32:49 +08:00
### What problem does this PR solve? Feat: Modify the style of the dataset page #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { cn } from '@/lib/utils';
|
||||
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
||||
import { random } from 'lodash';
|
||||
import { forwardRef } from 'react';
|
||||
@ -15,16 +16,24 @@ export const RAGFlowAvatar = forwardRef<
|
||||
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> & {
|
||||
name?: string;
|
||||
avatar?: string;
|
||||
isPerson?: boolean;
|
||||
}
|
||||
>(({ name, avatar, ...props }, ref) => {
|
||||
>(({ name, avatar, isPerson = false, className, ...props }, ref) => {
|
||||
const index = random(0, 3);
|
||||
console.log('🚀 ~ index:', index);
|
||||
const value = Colors[index];
|
||||
return (
|
||||
<Avatar ref={ref} {...props}>
|
||||
<Avatar
|
||||
ref={ref}
|
||||
{...props}
|
||||
className={cn(className, { 'rounded-md': !isPerson })}
|
||||
>
|
||||
<AvatarImage src={avatar} />
|
||||
<AvatarFallback
|
||||
className={`bg-gradient-to-b from-[${value.from}] to-[${value.to}]`}
|
||||
className={cn(
|
||||
`bg-gradient-to-b from-[${value.from}] to-[${value.to}]`,
|
||||
{ 'rounded-md': !isPerson },
|
||||
)}
|
||||
>
|
||||
{name?.slice(0, 1)}
|
||||
</AvatarFallback>
|
||||
|
||||
Reference in New Issue
Block a user