Skip to content

Semigroup instance on ClassName now joins with a space #512

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

Closed
wants to merge 1 commit into from
Closed

Conversation

machinedgod
Copy link

This produces a valid class string for the HTML 'class' attribute.

This produces a valid class string for the HTML 'class' attribute.
@safareli
Copy link
Contributor

safareli commented Jan 31, 2018

Why do you need <> to use space as glue? For the behavior you are proposing you can use Array.

Point of Semigroup instance was to "namespace" classnames like:

app = ClassName "sd-"
app <> ClassName "footer" == ClassName "sd-footer"

@safareli safareli requested a review from garyb January 31, 2018 19:53
@justinwoo
Copy link

I think what @machinedgod wants is to append together a bunch of separate classnames, which should be done with intercalate instead e.g. intercalate " " [a,b,c,d]

@machinedgod
Copy link
Author

My bad, I misunderstood what ClassName was supposed to do, then.
I use it in a way where I keep all classes as constants, and then append them together as necessary. This way I keep strings out of code; I assumed this is what wrapper is supposed to do.

@safareli
Copy link
Contributor

you would be doing:
HH.div [HP.classes [H.ClassName "foo", H.ClassName "bar"]]

ClassName is just a newtype over String so classes take Array of ClassName instead of Array of String.

btw you can take a look at #483 it's also related

@machinedgod
Copy link
Author

machinedgod commented Jan 31, 2018

Excellent, I wasn't aware of 'classes' property. That does much better.
I guess it was just intuitive for me to use 'append' to append classes together. Maybe the namespacing could be expanded upon, and have a newtype for a namespace with a separate function that applies namespace to every ClassName?

P.S. Also, thanks for pointing out your issue, it gives me a better idea on how to prepare a pull request properly.

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

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy