fix(avatar): document and add custom properties

references #14850
This commit is contained in:
Brandy Carney
2018-08-08 15:55:44 -04:00
parent c88e1adfd8
commit 6738ab7d87
5 changed files with 28 additions and 17 deletions

View File

@ -6,15 +6,8 @@
// --------------------------------------------------
:host {
@include border-radius($avatar-ios-border-radius);
--border-radius: #{$avatar-ios-border-radius};
width: $avatar-ios-width;
height: $avatar-ios-height;
}
::slotted(ion-img),
::slotted(img) {
@include border-radius($avatar-ios-border-radius);
overflow: hidden;
}

View File

@ -6,15 +6,8 @@
// --------------------------------------------------
:host {
@include border-radius($avatar-md-border-radius);
--border-radius: #{$avatar-md-border-radius};
width: $avatar-md-width;
height: $avatar-md-height;
}
::slotted(ion-img),
::slotted(img) {
@include border-radius($avatar-md-border-radius);
overflow: hidden;
}

View File

@ -5,13 +5,22 @@
// --------------------------------------------------
:host {
/**
* @prop --border-radius: Border radius of the avatar and inner image
*/
@include border-radius(var(--border-radius));
display: block;
}
::slotted(ion-img),
::slotted(img) {
@include border-radius(var(--border-radius));
width: 100%;
height: 100%;
object-fit: cover;
overflow: hidden;
}

View File

@ -8,6 +8,12 @@ Avatars can be used by themselves or inside of any element. If placed inside of
<!-- Auto Generated Below -->
## CSS Custom Properties
| Name | Description |
| ----------------- | ------------------------------------------- |
| `--border-radius` | Border radius of the avatar and inner image |
----------------------------------------------

View File

@ -9,9 +9,19 @@
<link rel="stylesheet" type="text/css" href="/css/ionic.min.css">
</head>
<body>
<body padding>
<h1>Default</h1>
<ion-avatar>
<img src="https://images.unsplash.com/photo-1485832329521-e944d75fa65e?auto=format&fit=crop&w=500&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D"/>
</ion-avatar>
<h1>Custom</h1>
<ion-avatar style="width: 200px; height: 200px">
<img src="https://images.unsplash.com/photo-1485832329521-e944d75fa65e?auto=format&fit=crop&w=500&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D"/>
</ion-avatar>
<ion-avatar style="--border-radius: 4px;">
<img src="https://images.unsplash.com/photo-1485832329521-e944d75fa65e?auto=format&fit=crop&w=500&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D"/>
</ion-avatar>
</body>
</html>