color-js / elements

WIP
14 stars 1 forks source link

[color-picker] Add info about parts to the docs and a demo with dynamic `space` #55

Closed DmitrySharabin closed 6 months ago

netlify[bot] commented 6 months ago

Deploy Preview for color-elements ready!

Name Link
Latest commit 9436cdc1b0df5cd5a75cd5e10f144ba404f47fa6
Latest deploy log https://app.netlify.com/sites/color-elements/deploys/664f4f184a90280007a1c83c
Deploy Preview https://deploy-preview-55--color-elements.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

DmitrySharabin commented 6 months ago

I would also avoid the indirection of separate functions for code that is only called once.

My rule of thumb for separating code into a function is:

  1. Does it get called multiple times?
  2. Is it long and convoluted to the point that if inlined it's making it harder to understand the code?
  3. Is it more generally useful, and could be used in other places in the future?

If the answer to all three is "no", then usually a separate function reduces readability instead of improving it.

That makes perfect sense. Thank you for sharing your techniques with me! 🙏 I fixed that part of the code.

LeaVerou commented 6 months ago

I would also avoid the indirection of separate functions for code that is only called once. My rule of thumb for separating code into a function is:

  1. Does it get called multiple times?
  2. Is it long and convoluted to the point that if inlined it's making it harder to understand the code?
  3. Is it more generally useful, and could be used in other places in the future?

If the answer to all three is "no", then usually a separate function reduces readability instead of improving it.

That makes perfect sense. Thank you for sharing your techniques with me! 🙏 I fixed that part of the code.

fromSelects() is still there.

DmitrySharabin commented 6 months ago

fromSelects() is still there.

I'm an idiot. 🤦‍♂️ I'm sorry. Fixed.