diff --git a/web/avatars/edit-user-avatar.css b/web/avatars/edit-user-avatar.css index e91584221..6e144270c 100644 --- a/web/avatars/edit-user-avatar.css +++ b/web/avatars/edit-user-avatar.css @@ -1,26 +1,33 @@ .editUserAvatarContainer { position: relative; height: 112px; width: 112px; + display: flex; + justify-content: center; + align-items: center; } .editAvatarBadge { display: flex; justify-content: center; align-items: center; position: absolute; bottom: 0; right: 0; width: 34px; height: 34px; color: var(--fg); background-color: var(--edit-avatar-button); border: 2px solid var(--bg); border-radius: 50%; cursor: pointer; transition-duration: 200ms; } .editAvatarBadge:hover { filter: brightness(0.8); } + +.editAvatarLoadingSpinner { + position: absolute; +} diff --git a/web/avatars/edit-user-avatar.react.js b/web/avatars/edit-user-avatar.react.js index 35da8cc7e..09103be78 100644 --- a/web/avatars/edit-user-avatar.react.js +++ b/web/avatars/edit-user-avatar.react.js @@ -1,26 +1,40 @@ // @flow +import invariant from 'invariant'; import * as React from 'react'; +import { EditUserAvatarContext } from 'lib/components/base-edit-user-avatar-provider.react.js'; + import EditUserAvatarMenu from './edit-user-avatar-menu.react.js'; import css from './edit-user-avatar.css'; import UserAvatar from './user-avatar.react.js'; +import LoadingIndicator from '../loading-indicator.react.js'; + +const loadingSpinner = ; type Props = { +userID: ?string, +disabled?: boolean, }; function EditUserAvatar(props: Props): React.Node { + const editUserAvatarContext = React.useContext(EditUserAvatarContext); + invariant(editUserAvatarContext, 'editUserAvatarContext should be set'); + + const { userAvatarSaveInProgress } = editUserAvatarContext; + const { userID } = props; return (
+
+ {userAvatarSaveInProgress ? loadingSpinner : null} +
); } export default EditUserAvatar;