Code Monkey home page Code Monkey logo

Comments (4)

mazz-seven avatar mazz-seven commented on September 6, 2024

What about solving this with classes or inline styles?
I think it's better to keep the directives count to a minimum.

from surface.

msaraiva avatar msaraiva commented on September 6, 2024

Hi @mazz-seven!

I agree we should keep the directives count to a minimum, however, the :show directive seems to be extremely useful in Surface especially because :if cannot be used along with :for in the same node (btw, I have a TODO to add a static check for this). If you want to conditionally show a component/tag, currently you need to either create an extra node or add a filter in the for comprehension. Vue.js also has a v-show directive and I'm not aware of any problem in the community regarding its use. Since we're kind of mapping most of the Vue behaviours in our directives, it sounds like a good addition.

And just for the record, I have only one more directive to be added before the first release, which is a :phx-value which will accept a keyword list or a map. So instead of being forced to pass values as separated attributes like:

phx-value-myvar1="value1" phx-value-myvar2="value2" phx-value-myvar3="value3"

we can use:

:phx-value={{myvar1: "value1", myvar2: "value2", myvar3="value3"}}

or

values = %{,,,}
...
:phx-value={{values}}

Since :show is already on master, I'll close this issue but feel free to move on with the discussion in case you have other strong arguments against it ;)

from surface.

mazz-seven avatar mazz-seven commented on September 6, 2024

The Phoenix value directive is an absolutely going to improve our life.

Regarding, the :show directive, I don't have anything against it. I'm a heavy user of Reactjs so we don't really have any directives in it.
I only remember the times with Angular 1, that have a confusing amount of directives.
So, what I'm trying to say is, we should think really hard about adding directives. They are easy to add but almost impossible to remove. ;)

from surface.

msaraiva avatar msaraiva commented on September 6, 2024

we should think really hard about adding directives. They are easy to add but almost impossible to remove. ;)

Wise words 🙂

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.