cellplatform / platform-0.2.0

/sys (shared system modules)
Other
4 stars 2 forks source link

sys.net.webrtc: UI.<Connect> #144

Closed philcockfield closed 1 year ago

philcockfield commented 1 year ago

Design Goal: Network connection UI setup (data and/or video) with only a "single line of code™️" setup.

Components:

image

Usage:

const self = await Connect.peer();  // ← NB: optional, explicitly secifying the peer.
<Connect.Stateful self={self} onChange={(e) => state.change((d) => {/**/})} />

Single line entry:

<Connect.Stateful self={self} onChange={ /* ... */ }} />
image

Within DevHarness spec:

e.it('ui:header', async (e) => {
  const dev = Dev.tools<T>(e, initial);
  const state = await dev.state();

  dev.header.border(-0.1).render((e) => {
    return (
      <Connect.Stateful
        margin={[0, 0, 20, 0]}
        onChange={(e) =>
          state.change((d) => {
            d.props.selected = e.selected;
            d.props.client = e.client;
          })
        }
      />
    );
  });
});

Single line entry:

<Connect.Stateful onChange={ /* ... */ }} />
image
philcockfield commented 1 year ago

sys.net.webrtc.ui.<Connect>

https://github.com/cellplatform/platform-0.2.0/assets/185555/ac66880f-2699-44d4-b7a9-6abb0bd8cf6a