-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui5-avatar): add initials, imageFitType and bg-color (#1151)
- Loading branch information
1 parent
6733de9
commit 5d27c7f
Showing
8 changed files
with
354 additions
and
31 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<div class="ui5-avatar-root"> | ||
{{#if displayIcon}} | ||
{{#if image}} | ||
<span alt="avatar" class="ui5-avatar-img" style="background-image: url({{image}})"></span> | ||
{{else if icon}} | ||
<ui5-icon class="ui5-avatar-icon" name="{{icon}}"></ui5-icon> | ||
{{else}} | ||
<img alt="avatar" class="ui5-avatar-img" src="{{img}}"/> | ||
{{else if initials}} | ||
<span class="ui5-avatar-initials">{{validInitials}}</span> | ||
{{/if}} | ||
</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
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,104 @@ | ||
import DataType from "@ui5/webcomponents-base/dist/types/DataType.js"; | ||
|
||
/** | ||
* Different types of AvatarBackgroundColor. | ||
* @lends sap.ui.webcomponents.main.types.AvatarBackgroundColor.prototype | ||
* @public | ||
*/ | ||
const AvatarBackGroundColors = { | ||
/** | ||
* | ||
* @public | ||
* @type {Accent1} | ||
*/ | ||
Accent1: "Accent1", | ||
|
||
/** | ||
* | ||
* @public | ||
* @type {Accent2} | ||
*/ | ||
Accent2: "Accent2", | ||
|
||
/** | ||
* | ||
* @public | ||
* @type {Accent3} | ||
*/ | ||
Accent3: "Accent3", | ||
|
||
/** | ||
* | ||
* @public | ||
* @type {Accent4} | ||
*/ | ||
Accent4: "Accent4", | ||
|
||
/** | ||
* | ||
* @public | ||
* @type {Accent5} | ||
*/ | ||
Accent5: "Accent5", | ||
|
||
/** | ||
* | ||
* @public | ||
* @type {Accent6} | ||
*/ | ||
Accent6: "Accent6", | ||
|
||
/** | ||
* | ||
* @public | ||
* @type {Accent7} | ||
*/ | ||
Accent7: "Accent7", | ||
|
||
/** | ||
* | ||
* @public | ||
* @type {Accent8} | ||
*/ | ||
Accent8: "Accent8", | ||
|
||
/** | ||
* | ||
* @public | ||
* @type {Accent9} | ||
*/ | ||
Accent9: "Accent9", | ||
|
||
/** | ||
* | ||
* @public | ||
* @type {Accent10} | ||
*/ | ||
Accent10: "Accent10", | ||
|
||
/** | ||
* | ||
* @public | ||
* @type {Placeholder} | ||
*/ | ||
Placeholder: "Placeholder", | ||
}; | ||
|
||
/** | ||
* @class | ||
* Different types of AvatarBackgroundColor. | ||
* @constructor | ||
* @author SAP SE | ||
* @alias sap.ui.webcomponents.main.types.AvatarBackgroundColor | ||
* @public | ||
* @enum {string} | ||
*/ | ||
class AvatarBackgroundColor extends DataType { | ||
static isValid(value) { | ||
return !!AvatarBackGroundColors[value]; | ||
} | ||
} | ||
|
||
AvatarBackgroundColor.generataTypeAcessors(AvatarBackGroundColors); | ||
|
||
export default AvatarBackgroundColor; |
Oops, something went wrong.