-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from kaliber5/image-layout
Support fixed and responsive layouts
- Loading branch information
Showing
9 changed files
with
476 additions
and
306 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
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 was deleted.
Oops, something went wrong.
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,24 @@ | ||
import { inject as service } from '@ember/service'; | ||
import { htmlSafe } from '@ember/string'; | ||
import Helper from '@ember/component/helper'; | ||
import ResponsiveImageService from 'ember-responsive-image/services/responsive-image'; | ||
|
||
/** | ||
* @class responsiveImageResolve | ||
* @namespace Helpers | ||
* @extends Ember.Helper | ||
* @public | ||
*/ | ||
export default class ResponsiveImageResolve extends Helper { | ||
@service | ||
responsiveImage!: ResponsiveImageService; | ||
|
||
compute( | ||
[image, size]: [string, number | undefined] /*, hash*/ | ||
): ReturnType<typeof htmlSafe> | undefined { | ||
const responsive = this.responsiveImage.getImageMetaBySize(image, size) | ||
?.image; | ||
|
||
return responsive ? htmlSafe(responsive) : undefined; | ||
} | ||
} |
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,4 @@ | ||
.eri-responsive { | ||
width: 100%; | ||
height: auto; | ||
} |
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 +1,9 @@ | ||
<h2>Fixed</h2> | ||
|
||
<ResponsiveImage @width={{200}} @image="assets/images/test.png"/> | ||
|
||
<h2>Responsive</h2> | ||
|
||
<ResponsiveImage @image="assets/images/test.png"/> | ||
|
||
|
Oops, something went wrong.