Code Monkey home page Code Monkey logo

Comments (14)

msaraiva avatar msaraiva commented on July 30, 2024 2

@neilberkman just to make it clear, you should be able to use "clipboard__icon" today if you write the key as a string, so:

<div class={{ "clipboard__icon" => true }}>

should be translated to:

<div class="clipboard__icon">

Pay attention that "clipboard__icon": true is different from "clipboard__icon" => true. In the former the key is an atom, in the latter, the key is a string.

In case the above doesn't work as expected, we have a bug so please let me know.

from surface.

wrren avatar wrren commented on July 30, 2024 1

Personally I quite like the auto-conversion feature, and I think it makes perfect sense when you think about conventions around CSS classes. As long as it's called out in the documentation clearly I think it's fine.

Alternatively you could use underscore-case -> kebab-case conversion instead; if anything I think that makes even more sense since you're going from idiomatic elixir naming to idiomatic CSS naming.

from surface.

msaraiva avatar msaraiva commented on July 30, 2024 1

All right, folks!

I've decided to drop the automatic camel-to-kebab conversion. For those that like this feature, I'm willing to find another way to provide similar behaviour by maybe adding a built-in function or some kind of modifier to make its use explicit.

The next alpha version should be released already without it.

Thank you all for the fantastic feedback!

from surface.

wrren avatar wrren commented on July 30, 2024

Another option would be to make this a config setting, or something passed as a __using__ option? e.g:

use Surface, convert_classes: false

from surface.

lnr0626 avatar lnr0626 commented on July 30, 2024

for what it's worth, I prefer to just specify the css class name without any conversion

the underscore to kebab case conversion would cause issues with BEM style CSS if i'm not mistaking what you're suggesting

from surface.

neilberkman avatar neilberkman commented on July 30, 2024

the underscore to kebab case conversion would cause issues with BEM style CSS if i'm not mistaking what you're suggesting

We're encountering this now: #50 (comment)

from surface.

lnr0626 avatar lnr0626 commented on July 30, 2024

I recognize that those names wouldn't be idiomatic elixir; however I feel like the edge cases get fairly extensive when we start converting things; and as the names are technically css and not elixir the non-idiomaticness doesn't bother me too much

from surface.

brainlid avatar brainlid commented on July 30, 2024

@msaraiva Speaking to your point about feature causing confusion, I've had to pull up the docs to check how to do it multiple times because it doesn't feel natural to me. So I'm sympathetic to that concern.

I do like the ability to include a class with a boolean value (or function call) so I want the ability to remain, but the implementation and API are fine to change for me. I'm not using any CSS libraries that have issues with it.

from surface.

msaraiva avatar msaraiva commented on July 30, 2024

Another option would be to make this a config setting

@wrren I would avoid a config for that as much as possible since it doesn't solve the issue of confusion. I'm inclined to drop the feature unless we can make sure that improving the docs/examples will be enough.

I'll merge #51 in the meantime and wait for more feedback to make a final decision about dropping the feature.

Thank you all for your comments ❤️

from surface.

mazz-seven avatar mazz-seven commented on July 30, 2024

Personally I didn't used the auto-convert. I think the argument to support isn't sufficient. There are many ways to write css class names, Im using tailwindcss for example. So to support one way of writing class names that cause so many problems seems unnecessary. Hope my input helps :)
On related topic, can I do something like that?

some_classes = "class_1 class_2 .." 
<div class={{ ^some_classes => true }}>

from surface.

msaraiva avatar msaraiva commented on July 30, 2024

@mazz-seven thanks for the input.

Regarding the suggested code, it's currently not possible. The closest thing I can come up with, in case you'll alway use true, is:

some_classes = [:class_1, :class_2, ...] 
<div class={{ some_classes }}>

However, I'm not sure which other cases you want to cover, so this is probably not what you're looking for.

from surface.

gdub01 avatar gdub01 commented on July 30, 2024

I'd vote for no automatic conversion.

Absinthe has auto camelCase conversion for graphql queries and there have been many questions from people wondering what happened to their field names. Absinthe allows users to override it, and have good docs, but it has still surprised many people.

I understand why they did it, and appreciate it in their case.. but I would not enjoy it as much for css... I'd just prefer it to be what I think it is.

from surface.

mathewdgardner avatar mathewdgardner commented on July 30, 2024

I'm in favor of not automatically kebabing or to at least provide an escape hatch. I am using an existing style sheet that I'm writing components for and it mixes use of kebab and camel cases.

from surface.

msaraiva avatar msaraiva commented on July 30, 2024

Resolved in #62. Thanks @zamith!

from surface.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.