Skip to content

Commit

Permalink
Add avatar icon as login property w/ default.
Browse files Browse the repository at this point in the history
  • Loading branch information
a60915 authored and mjarosch committed Jul 1, 2024
1 parent 3a9de0c commit 6f10f1c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/ra-ui-materialui/src/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ import { LoginForm as DefaultLoginForm } from './LoginForm';
* );
*/
export const Login = (props: LoginProps) => {
const { children = defaultLoginForm, backgroundImage, ...rest } = props;
const containerRef = useRef<HTMLDivElement>(null);
const {
children = defaultLoginForm,
backgroundImage,
avatarIcon = defaultAvatarIcon,
...rest
} = props;
const containerRef = useRef<HTMLDivElement>();
let backgroundImageLoaded = false;
const checkAuth = useCheckAuth();
const navigate = useNavigate();
Expand Down Expand Up @@ -68,9 +73,7 @@ export const Login = (props: LoginProps) => {
<Root {...rest} ref={containerRef}>
<Card className={LoginClasses.card}>
<div className={LoginClasses.avatar}>
<Avatar className={LoginClasses.icon}>
<LockIcon />
</Avatar>
<Avatar className={LoginClasses.icon}>{avatarIcon}</Avatar>
</div>
{children}
</Card>
Expand All @@ -80,7 +83,10 @@ export const Login = (props: LoginProps) => {

const defaultLoginForm = <DefaultLoginForm />;

const defaultAvatarIcon = <LockIcon />;

export interface LoginProps extends HtmlHTMLAttributes<HTMLDivElement> {
avatarIcon?: ReactNode;
backgroundImage?: string;
children?: ReactNode;
className?: string;
Expand Down

0 comments on commit 6f10f1c

Please sign in to comment.