-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add container to render image as background behind children #70
Conversation
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.
One lil question, but otherwise this looks great.
); | ||
const newDpr = toFixed(2, window.devicePixelRatio || 1); | ||
|
||
set(this, '_width', newWidth); |
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.
Will setting all three of these in sequence like this trigger three recomputes on the _src
property, or is it debounced?
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.
I've verified by testing on the example app that this only triggers one recompute 👍
addon/components/imgix-bg.js
Outdated
@@ -93,6 +92,7 @@ export default Component.extend(ResizeAware, { | |||
'fit', | |||
'disableSrcSet', | |||
function() { | |||
console.log('compute src'); |
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.
This console.log was probably checked in by accident?
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.
Whoops... nothing to see here.
NB: This should incorporate the changes brought in by #72 before being merged @sherwinski @jayeb |
da03e0f
to
43f591e
Compare
43f591e
to
072d099
Compare
@jayeb |
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.
One little nit, but otherwise I think this is ready to go 👍.
}); | ||
|
||
module('default css class', function() { | ||
test('it allows setting overriding the default class via config', async function(assert) { |
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.
[nit] Lil typo here
072d099
to
6aa58f1
Compare
README.md
Outdated
@@ -225,6 +225,25 @@ module.exports = function(environment) { | |||
```hbs | |||
{{imgix-image path="/test.png" disableLibraryParam={true} }} | |||
``` | |||
### imgix-bg | |||
|
|||
This component will render a `div` whose `background-image` is set to the passed in image path. Content can be added within the `imgix-bg` tags and the component will automatically resize to fit around it. |
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.
Let's switch "passed in" to "given".
README.md
Outdated
{{/imgix-bg}} | ||
``` | ||
|
||
Which will generate html similar to the following: |
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.
Can we say "This will generate..." instead?
README.md
Outdated
Which will generate html similar to the following: | ||
|
||
```html | ||
<div id="ember226" alt="" style="background-image: url('https://my-social-network.com/users/1.png?fit=crop&w=1246&h=15&dpr=2&ixlib=ember-2.0.0');background-size: cover" class="imgix-bg ember-view"> |
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.
Let's distill this example a little bit by removing the id
and alt
attributes.
README.md
Outdated
</div> | ||
``` | ||
|
||
**Note:** `imgix-bg` will respect any global default parameters unless explicitly overriden |
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.
[nit] This sentence is missing a period.
31a5dcc
to
b47fcf7
Compare
Description
This PR adds a new component which enables an image to be rendered as a background behind children components.
This PR has existed for a while in react-imgix, and is being ported over to this library.
New Feature
feat(<area>): added new way to do this cool thing #issue-number
Steps to Test
Review new tests.