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

Clean up arguments of Layout functions #109

Open
GlenDC opened this issue Sep 1, 2015 · 1 comment
Open

Clean up arguments of Layout functions #109

GlenDC opened this issue Sep 1, 2015 · 1 comment

Comments

@GlenDC
Copy link
Owner

GlenDC commented Sep 1, 2015

The layout system is pretty good now. The arguments lenghts however are quite lengthy, and the resulting generators aren't very flexible style wise.

The latter is especially true for generators that ar ea collection of multiple elements, in which styling the individual elements beyond the given options is impossible. Example:

field : FieldType -> (String -> TrWorkActions.Action) -> String -> String -> String -> TrColor.RgbaColor -> TrColor.RgbaColor -> TrColor.RgbaColor -> TrColor.RgbaColor -> Float -> Float -> TrLayout.Generator
field fieldType toAction label help value color inputColor inputBackground inputBorder labelSize size =
    {-| ... -}

As a user of the above given example generator:

  • It is impossible to style label beyond the text size and color without also affecting the input element
  • It is quite error prone to give arguments as there are:
    • Many arguments
    • No named arguments (as that is not supported in Elm)

Proposed solutions:

  • A solution to the extensibility is to instead of asking for individual styles such as font size and color, to ask for a Styles argument per individual element. (e.g. that would mean 2 Styles arguments for field, one for the label and one for the actual input element)
  • A solotuion for the lengthy generator functions would be to put all static arguments in a nice Descriptor type alias and only have the dynamic variables as seperate variables.
    • This should also make it easier to share such descriptions easier
    • Extensible records might be of help here, although I'm not entirely sure of this.
@GlenDC
Copy link
Owner Author

GlenDC commented Sep 3, 2015

It's also not possible for now to add any other attributes to Html elements.

We know that it is important to keep the layout module simple, but at the same time it shouldn't sacrafice usability and control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant