question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider grouping the possible UI elements under one module

See original GitHub issue

Hello @JaggerJo,

This project looks really good and I really like the API used for the view elements. It looks like it was loosely based on fabulous-simple-elements. If that the case, I would like to suggest something that I regret not adding to that library -> not being able to see which elements you can use!

Let me explain: if the user is a beginner, then there is no way to tell which elements are available in the framework. You have to go through the docs and search for elements you need. Of course once you have found them, it becomes easy to find their properties, but only after you have searched the docs.

I propose to add a module, maybe named Ava that contains the constructor for all possible UI elements. Instead of

Button.create [
    Button.onClick (fun _ -> dispatch Increment)
    Button.content "click to increment"
]

I suggest writing:

Ava.button [
    Button.onClick (fun _ -> dispatch Increment)
    Button.content "click to increment"
]

This way the beginner user has a nice “entry point” to the possible UI elements that can be used and from there the search for elements becomes even easier. The reason for the name Ava is that the formatting works nicely when the propery list is indented with 4 spaces such that the property modules become aligned with the constructor function. This is how it is done in both Mui module from Fable.MaterialUI and the Ant module from Fable.AntDesign.

It would be a plus if the property module was also lower-case (but would introduce a breaking change)

Ava.button [
    button.onClick (fun _ -> dispatch Increment)
    button.content "click to increment"
]

What do you think?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JaggerJocommented, Feb 18, 2020

Hello @JaggerJo, sorry I didn’t connect back to you! It seems you have thought about it more than I did 😄 I especially liked this snippet

DSL.Button.create [                          
    Button.dock Dock.Bottom                  
    Button.onClick (fun _ -> dispatch Reset) 
    Button.content "reset"                   
]                                            

Because there is only one use of DSL which becomes the entry point of discovery, really cool stuff. Thanks for taking the time with your detailed response 💯

@Zaid-Ajaj I have to admit that the formatting was pure luck, I never thought about DSL. = indent size TBH. But it’s neat!

Thanks for the feedback! 😊

0reactions
Zaid-Ajajcommented, Feb 17, 2020

Hello @JaggerJo, sorry I didn’t connect back to you! It seems you have thought about it more than I did 😄 I especially liked this snippet

DSL.Button.create [                          
    Button.dock Dock.Bottom                  
    Button.onClick (fun _ -> dispatch Reset) 
    Button.content "reset"                   
]                                            

Because there is only one use of DSL which becomes the entry point of discovery, really cool stuff. Thanks for taking the time with your detailed response 💯

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using dynamic UI components when using Shiny modules
We have a Shiny app with several modules. Most of them are independent of each other but one is a special case of...
Read more >
Common modularization patterns
The following are examples of common modules: UI module: If you use custom UI elements or elaborate branding in your app, you should...
Read more >
Design a Simple OmniScript Unit | Salesforce Trailhead
OmniScript elements are grouped by type, based on the kind of functionality they perform, and they each have settings that must be configured...
Read more >
Using Grids in Interface Designs
Column grid involves dividing a page into vertical columns. UI elements and content are then aligned to these columns. Modular grid extends ...
Read more >
[Solved] UI Button not working at all
The Title menu works fine, but it doesn't have a event system or canvas group. I tried copying all the components from the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found