Related: Currently the architecture assumes that there’s a single view, model, or controller. Many of these could (and maybe should) be broken into smaller logic pieces. For example, there’s TextAndImageButton which has a TextAndImageModel, when all it really needs is a TextModel and an ImageModel. I think part of the problem is that the component is too strongly coupled to the model. I think what we really need is for a lightweight way for a component to say “Someone is setting property x. Anyone who cares please take note.” I think the work I started on Strands and Beads a number of months back might be the right direction for this.
> On Dec 7, 2017, at 12:51 PM, Piotr Zarzycki <[email protected]> wrote: > > Hi Harbs, > > I would also place the logic which changes the image into the View bead. If > I correct understand your thoughts. I think if it is possible it would be > great reuse ImageButton in somehow, cause actually it is doing for one > state what you want. > > It is the matter of handling states in the view. > > Thanks, Piotr > > > 2017-12-07 11:46 GMT+01:00 Harbs <[email protected]>: > >> I need a toggle button which displays images (i.e. ImageToggleButton). >> >> Right now, the way ImageButton works is that the main component modifies >> the element to show an image. This works only if you want a single image no >> matter what the state of the button is. If you want different images on >> hover, active, selected, etc. that requires a separate component. >> Additionally, I wanted a button in an app which uses images for states. I >> ended up just using a plain old div and setting the background image via >> css for the different states. Adding components for each and every use case >> seems broken. >> >> Ideally, with Royale architecture, the component should really be much >> more about the behavior of the component and the view should be delegated >> to a bead. >> >> I’m thinking that the logic which sets the html of the element should be a >> a view bead. Any thoughts about reworking this? >> >> Harbs > > > > > -- > > Piotr Zarzycki > > Patreon: *https://www.patreon.com/piotrzarzycki > <https://www.patreon.com/piotrzarzycki>*
