Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a non-nestable version of Tabs component #14

Open
andersevenrud opened this issue Feb 24, 2019 · 0 comments
Open

Provide a non-nestable version of Tabs component #14

andersevenrud opened this issue Feb 24, 2019 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@andersevenrud
Copy link
Member

Currently the Tabs component is using hyperapp-nestable, which is great, but when you update a component property, it will not react to this unless you specify a key.

The downside to this is that it will force you to re-render the component.

To get around this, a slightly different version of the tabs component could be added:

app({
  selectedTab: -1,
  tabs: ['My Tab']
}, {
  setSelectedTab: selectedTab => ({selectedTab})
}, (state, actions) => {
  return h(Tabs, {
    selectedIndex: state.selectedTab,
    labels: state.tabs,
    onchange: (ev, index) => actions.setSelectedTab(index)
  }, [
    h(Box, {}, 'Tab contents'}
  ]);
}, $content);

This requires developer to wire up the tab switch event.

@andersevenrud andersevenrud added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Feb 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant