This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 833
Add ability to remove avatars #3719
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f43dac0
stash
t3chguy a8a6023
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy c40f9f5
Switch from focus-trap-react to react-focus-lock
t3chguy 2c93db3
Fix toggle switch keyboard accessibility
t3chguy 20ed671
Yay <AvatarSetting />
t3chguy ed9b3a8
fix styling
t3chguy ac16bea
Fix pointer styling
t3chguy e7c92ba
delint
t3chguy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
Copyright 2019 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
.mx_AvatarContextMenu { | ||
padding: 6px; | ||
} | ||
|
||
.mx_AvatarContextMenu_field, .mx_AvatarContextMenu_leave { | ||
padding: 3px 6px 3px 6px; | ||
cursor: pointer; | ||
white-space: nowrap; | ||
display: flex; | ||
align-items: center; | ||
line-height: 16px; | ||
} | ||
|
||
.mx_AvatarContextMenu_separator { | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
border-bottom-style: none; | ||
border-left-style: none; | ||
border-right-style: none; | ||
border-top-style: solid; | ||
border-top-width: 1px; | ||
border-color: $menu-border-color; | ||
} | ||
|
||
.mx_AvatarContextMenu_leave { | ||
color: $warning-color; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
Copyright 2019 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
.mx_AvatarSetting_avatar { | ||
width: 88px; | ||
height: 88px; | ||
margin-left: 13px; | ||
position: relative; | ||
} | ||
|
||
.mx_AvatarSetting_avatar > *, | ||
.mx_AvatarSetting_avatar img { | ||
display: block; | ||
width: 88px; | ||
height: 88px; | ||
border-radius: 4px; | ||
} | ||
|
||
.mx_AvatarSetting_avatar .mx_AvatarSetting_avatarOverlay_disabled { | ||
cursor: default; | ||
} | ||
|
||
.mx_AvatarSetting_avatar .mx_AvatarSetting_avatarPlaceholder { | ||
background-color: $settings-profile-placeholder-bg-color; | ||
} | ||
|
||
.mx_AvatarSetting_avatarOverlay { | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
display: none; | ||
text-align: center; | ||
vertical-align: middle; | ||
font-size: 10px; | ||
pointer-events: none; | ||
} | ||
|
||
.mx_AvatarSetting_avatar:hover .mx_AvatarSetting_avatarOverlay:not(.mx_AvatarSetting_avatarOverlay_disabled) { | ||
display: inline-block; | ||
opacity: 0.5 !important; | ||
color: $settings-profile-overlay-fg-color !important; | ||
background-color: $settings-profile-overlay-bg-color !important; | ||
} | ||
|
||
.mx_AvatarSetting_avatarOverlay_show { | ||
display: inline-block; | ||
opacity: 1; | ||
color: $settings-profile-overlay-placeholder-fg-color; | ||
background-color: $settings-profile-overlay-placeholder-bg-color; | ||
} | ||
|
||
.mx_AvatarSetting_avatarOverlayText { | ||
display: block; | ||
margin-top: 17px; | ||
margin-bottom: 8px; | ||
} | ||
|
||
.mx_AvatarSetting_noAvatarText { | ||
display: block; | ||
margin: 34px auto auto; | ||
} | ||
|
||
.mx_AvatarSetting_avatarOverlayImgContainer { | ||
position: relative; | ||
width: 14px; | ||
height: 14px; | ||
margin: auto; | ||
} | ||
|
||
.mx_AvatarSetting_avatarOverlayImg::before { | ||
background-color: $settings-profile-overlay-placeholder-fg-color; | ||
mask: url("$(res)/img/feather-customised/upload.svg"); | ||
mask-repeat: no-repeat; | ||
mask-size: 14px; | ||
mask-position: center; | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
} | ||
|
||
.mx_AvatarSetting_avatar:hover .mx_AvatarSetting_avatarOverlayImg::before { | ||
background-color: $settings-profile-overlay-fg-color !important; | ||
} | ||
|
||
.mx_AvatarSetting_avatarUpload { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
Copyright 2019 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {_t} from "../../../languageHandler"; | ||
import {MenuItem} from "../../structures/ContextMenu"; | ||
|
||
export default class AvatarContextMenu extends React.PureComponent { | ||
static propTypes = { | ||
uploadAvatar: PropTypes.func.isRequired, | ||
removeAvatar: PropTypes.func.isRequired, | ||
onFinished: PropTypes.func.isRequired, | ||
}; | ||
|
||
_onUploadAvatarClick = () => { | ||
this.props.uploadAvatar(); | ||
setImmediate(this.props.onFinished); | ||
}; | ||
|
||
_onRemoveAvatarClick = () => { | ||
this.props.removeAvatar(); | ||
setImmediate(this.props.onFinished); | ||
}; | ||
|
||
render() { | ||
return <div className="mx_AvatarContextMenu"> | ||
<MenuItem className="mx_AvatarContextMenu_field" onClick={this._onUploadAvatarClick}> | ||
{ _t('Upload new image') } | ||
</MenuItem> | ||
<hr className="mx_AvatarContextMenu_separator" /> | ||
<MenuItem className="mx_AvatarContextMenu_leave" onClick={this._onRemoveAvatarClick}> | ||
{ _t('Remove') } | ||
</MenuItem> | ||
</div>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated changes should probably be in their own PR for next time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup