JoshK2 / ng-spinners

Amazing collection of Angular spinners components with pure css.
https://bit.dev/joshk/ng-spinners
MIT License
29 stars 3 forks source link

Help wanted! - support size property #1

Open JoshK2 opened 4 years ago

JoshK2 commented 4 years ago

Hey, I want to add support to size property like I started to do in the react project https://github.com/joshK2/react-spinners-css#-list-of-spinners---proptypes-and-default-props

If someone wants to help me, it's with pleasure.

exia commented 4 years ago

@JoshK2 I'll get on this!

Just too clarify, you want a [size]="'64'" or size="64" which would be converted to 64px ?

Please assign to me.

JoshK2 commented 4 years ago

Hey @exia Yes, I want to add the option of sizing as I do with the react spinners project, but in some component, you need to calculate this with percentage. Like I do here: https://github.com/JoshK2/react-spinners-css/blob/master/src/components/Ring/index.js

The option needs to be unlimited, so, for example, if you have a div in another div, and the relation between them is 50%, so the size of inside onw one need to be size * 0.5

Thank you very much!

exia commented 4 years ago

Hey @JoshK2

Thanks for the prompt reply.

So, are you saying that units should always be sent in as a percentage? Or should we allow the option to be sent in?

I.e.

<ring-loader [size]="'60'" [units]="'px'"></ring-loader>

<ring-loader [size]="'100'" [units]="'%'"></ring-loader>

But it will default to pixels?

I'm not sure I fully understand what you're saying from the "option needs to be unlimited", and the relation between the divs?

Are you talking about divs within the component?

Sorry, just want to make sure I do it right first time!

JoshK2 commented 4 years ago

@exia the value is number and convert it to a pixel. "option needs to be unlimited": if the spinner is like this:

<div style="width: 100px">
  <div style="width: 50px"></div>
</div>

and the value is number, the calculation needs to be like this;

<div style="width: size px">
  <div style="width: size * 0.5 px"></div>
</div>

Thank you for the support!

exia commented 4 years ago

@JoshK2

Makes perfect sense, thanks for clarifying.

I'll get it done as soon as I get a chance (should be tonight)!