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

Generate prop aliases for specific elements where applicable #5

Closed
Zaid-Ajaj opened this issue Nov 22, 2019 · 2 comments
Closed

Generate prop aliases for specific elements where applicable #5

Zaid-Ajaj opened this issue Nov 22, 2019 · 2 comments
Labels
question Further information is requested

Comments

@Zaid-Ajaj
Copy link

Generate prop aliases for specific elements such that there is no need to fallback to prop for "most commonly used" properties:

Before

Bulma.columns [
  Bulma.column [
    column.is2
    prop.children [
      Bulma.button [
        button.isPrimary
        prop.onClick (fun _ -> DoStuff)
        prop.text "Do Stuff"
      ]
    ]
  ]
]

After

Bulma.columns [
  Bulma.column [
    column.is2
    column.children [
      Bulma.button [
        button.isPrimary
        button.onClick (fun _ -> DoStuff)
        button.text "Do Stuff"
      ]
    ]
  ]
]

I think this looks much cleaner and symmetric. Users would only fallback to prop when needing some exotic properties.

"Most common properties" are things like prop.text, prop.children, prop.onClick (button), prop.onChange (input), prop.valueOrDefault (input), prop.key, prop.src (image) etc.

What do you think about this?

@Dzoukr
Copy link
Owner

Dzoukr commented Nov 25, 2019

Hmmmmm I am not sure about this, frankly. The biggest benefit of this small library is that it's nothing more than just extension to Feliz. I tend to build on Feliz instead of overloading / shadowing its functionality. The message here is: Hey, here you have some Feliz divs, inputs, buttons with pre-selected className, but for everything else use the original syntax. Whatever you add into future versions (if not breaking change) of Feliz, it should be available immediatelly and used with existing extensions. I actually have that in README as advantage of this library, that most of the time you remaing with known existing Feliz syntax.

I agree it would look way more concise to have button.onClick instead of prop.onClick but thinking if this should be concern of extension.

Damn, you made me thinking again! 😄

@Dzoukr Dzoukr added the question Further information is requested label Nov 25, 2019
@Zaid-Ajaj
Copy link
Author

It is not really a big deal to be honest. From a user point of view I am following a vague guideline called "Don't make me think" 😄 and in this case I was trying to minimize the number of places the user has to look for properties if he or she already started looking under the button module. Even Fulma does a little bit of this where it adds Button.OnClick and Input.OnChange so I thought it might be nice here too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants