Coder Social home page Coder Social logo

Code nesting about justpy HOT 8 CLOSED

justpy-org avatar justpy-org commented on June 22, 2024
Code nesting

from justpy.

Comments (8)

elimintz avatar elimintz commented on June 22, 2024 1

Got it. I added the children kwarg, it will be in the next version.

from justpy.

elimintz avatar elimintz commented on June 22, 2024

I think you could just leave the corresponding html in the code as a comment if you need clarity. It grows on you. Now I prefer the JustPy format to html, but at first html was clearer.

from justpy.

mjmare avatar mjmare commented on June 22, 2024

Do you see downsides of adding something like the 'children' kwarg? Then it is up to the user to use that or the 'a=...' or '.add()' constructs.

from justpy.

elimintz avatar elimintz commented on June 22, 2024

Can you please give an example how the children kwarg would be used? Just that anything in the list would be added as a child component?
That would be simple to add.

from justpy.

mjmare avatar mjmare commented on June 22, 2024

I was thinking something like:

jp.QItem( clickable=True, 
                v_ripple=True, 
                click=button_click, 
                a=c2,      # so 'a=' and 'children' can both be used. 
                children=[ 
                    jp.QItemSection(avatar=True),
                    jp.QAvatar(size='100px',
                                      font_size='52px',
                                      color=color_from_state(u['state']),
                                      text_color='white',
                                      icon=icon_from_state(u['state'])),
                    jp.QItemSection(children=[
                          jp.QItemLabel(classes=['text-h3'], text=u['name'])
                          jp.QItemLabel(caption=True, a=c6, text=u['state'])),
                    ],
                    jp.QSeparator(spaced=True, inset=True, a=c2)
                 ])

(sorry for the wonky indenting)

from justpy.

elimintz avatar elimintz commented on June 22, 2024

Can you please give an example how the children kwarg would be used? Just that anything in the list would be added as a child component?
That would be simple to add.

from justpy.

mjmare avatar mjmare commented on June 22, 2024

See children kwarg used twice in #55 (comment)

from justpy.

knoxvilledatabase avatar knoxvilledatabase commented on June 22, 2024

Although I've now gotten used to writing JustPy code without nesting, before switching to JustPy we wrote a ReactJS solution similar (yet not nearly as powerful) using code nesting:

Div(
    Span(
        text='Hello World',
        classnames='test',
        style='margin-top:50px',
    ),
    classnames='test_div',
    style='margin-bottom:10px',
)

This nesting concept originally came from https://github.com/django-crispy-forms/django-crispy-forms

from justpy.

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.