public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>, yew-devel@lists.proxmox.com
Subject: Re: [PATCH yew-widget-toolkit v2] widget: add 'div' macro
Date: Sun, 5 Apr 2026 11:08:11 +0200	[thread overview]
Message-ID: <3570c013-8109-45cb-a054-7072fcea559e@proxmox.com> (raw)
In-Reply-To: <20260402134337.3433085-1-d.csapak@proxmox.com>

On 02/04/2026 15:43, Dominik Csapak wrote:
> this is just a simple wrapper around the `Container` widget, but it's
> very useful in situations where bare strings are used in a flex layout,
> since e.g. a `Row` with multiple children that are all strings won't get
> a proper flex layout (since they're not elements)
> 
> So instead of writing
> ```
> Row::new()
>     .with_child(Container::new().with_child("Text1"))
>     .with_child(Container::new().with_child("Text2"))
> ```
> 
> one can now write
> ```
> Row::new()
>     .with_child(div!("Text1"))
>     .with_child(div!("Text2"))
> ```
> 
> which is much shorter and more readable.

Yes, but why a macro and not a normal method for this? Macro's are a bit
opaque, totally fine if there is a benefit for adding them, but here I
cannot see a big blocker against adding an e.g. TextContainer wrapper or
an Container::new_with_text (might need better naming, but just to relay
the idea), especially if that's your main use case. Or for a more generic
use case we could add a "Container::new_with_child" constructor or also
a wrapper type (SimpleContainer::new(child)).

And it isn't exactly a plain div, as then one could just use the html!
macro from yew, so the name as is, is IMO not totally ideal. If we go
the macro way (what's Dietmars opinion on this?), I'd favor to call it
container! to better reflect that it uses the pwt container class.




      reply	other threads:[~2026-04-05  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 13:42 Dominik Csapak
2026-04-05  9:08 ` Thomas Lamprecht [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3570c013-8109-45cb-a054-7072fcea559e@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=d.csapak@proxmox.com \
    --cc=yew-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal