Skip to content

Commit

Permalink
fix(thumbnail): add and document custom properties
Browse files Browse the repository at this point in the history
references #14850
  • Loading branch information
camwiegert committed Aug 8, 2018
1 parent 5f6f6a1 commit c88e1ad
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 23 deletions.
7 changes: 7 additions & 0 deletions core/src/components/thumbnail/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ Thumbnails can be used by themselves or inside of any element. If placed inside
<!-- Auto Generated Below -->


## CSS Custom Properties

| Name | Description |
| ----------------- | ------------------------------ |
| `--border-radius` | Border radius of the thumbnail |
| `--size` | Size of the thumbnail |


----------------------------------------------

Expand Down
11 changes: 11 additions & 0 deletions core/src/components/thumbnail/test/standalone/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,16 @@
<ion-thumbnail>
<img src="https://images.unsplash.com/photo-1485832329521-e944d75fa65e?auto=format&fit=crop&w=1950&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D"/>
</ion-thumbnail>

<ion-thumbnail class="custom">
<img src="https://images.unsplash.com/photo-1485832329521-e944d75fa65e?auto=format&fit=crop&w=1950&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D"/>
</ion-thumbnail>

<style>
.custom {
--border-radius: 50%;
--size: 120px;
}
</style>
</body>
</html>
14 changes: 2 additions & 12 deletions core/src/components/thumbnail/thumbnail.ios.scss
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
@import "./thumbnail";
@import "./thumbnail.ios.vars";


// iOS Thumbnail
// --------------------------------------------------

:host {
@include border-radius($thumbnail-ios-border-radius);

width: $thumbnail-ios-width;
height: $thumbnail-ios-height;
}

::slotted(ion-img),
::slotted(img) {
@include border-radius($thumbnail-ios-border-radius);

overflow: hidden;
--size: #{$thumbnail-ios-width};
--border-radius: #{$thumbnail-ios-border-radius};
}
13 changes: 2 additions & 11 deletions core/src/components/thumbnail/thumbnail.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
// --------------------------------------------------

:host {
@include border-radius($thumbnail-md-border-radius);

width: $thumbnail-md-width;
height: $thumbnail-md-height;
}

::slotted(ion-img),
::slotted(img) {
@include border-radius($thumbnail-md-border-radius);

overflow: hidden;
--size: #{$thumbnail-md-width};
--border-radius: #{$thumbnail-md-border-radius};
}
13 changes: 13 additions & 0 deletions core/src/components/thumbnail/thumbnail.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,26 @@
// --------------------------------------------------

:host {
/**
* @prop --border-radius: Border radius of the thumbnail
* @prop --size: Size of the thumbnail
*/

@include border-radius(var(--border-radius));

display: block;

width: var(--size);
height: var(--size);
}

::slotted(ion-img),
::slotted(img) {
@include border-radius(var(--border-radius));

width: 100%;
height: 100%;

object-fit: cover;
overflow: hidden;
}

0 comments on commit c88e1ad

Please sign in to comment.