Skip to content
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

Apply Dynamic Styles #135

Closed
jrjohnson opened this issue May 13, 2018 · 2 comments
Closed

Apply Dynamic Styles #135

jrjohnson opened this issue May 13, 2018 · 2 comments

Comments

@jrjohnson
Copy link
Contributor

@jrjohnson jrjohnson commented May 13, 2018

My tooltip target component is styled dynamically with something like:

style: computed('event', function() {
  return new htmlSafe(`background-color: ${this.event.color};`);
}),

I would like to be able to apply this same style to the tooltip itself so that they match. There is a way to do this by applying a dynamic class to the tooltip class=(concat 'event-tooltip-' elementId) and then doing some DOM manipulation inside of an onChange action, but it feels un-embery to traverse the DOM from inside of a component like that.

Would it be possible to allow passing a style into attach-tooltip or, alternatively pass the tooltip element into onChange so it could be manipulated there?

Thanks for the great addon!

@kybishop

This comment has been minimized.

Copy link
Owner

@kybishop kybishop commented May 14, 2018

Hey @jrjohnson, I'd gladly accept a PR to apply style directly to the inner attachment element https://github.com/kybishop/ember-attacher/blob/master/addon/templates/components/attach-popover.hbs#L14

We already do this with class, so it makes sense to do it with style too

@jrjohnson

This comment has been minimized.

Copy link
Contributor Author

@jrjohnson jrjohnson commented May 17, 2018

Thanks @kybishop, I created #136.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.