Autodesk / orion-ui

UI Components that work seamlessly in multiple UI frameworks
https://goo.gl/shxHPB
Other
22 stars 6 forks source link

Create stateful Tabs #299

Open aneyzberg opened 7 years ago

aneyzberg commented 7 years ago

Use the tabs that Cameron refactored instead of current tabs

camwest commented 7 years ago

@aneyzberg tabs don't seem to be exported in the public API https://github.com/Autodesk/orion-ui/blob/master/packages/react-hig/src/react-hig.js so I can't test this.

nfiniteset commented 7 years ago

This has been on my mind as I've moved our components into adapters.

Here's how we build a tree of components in the side nav today:

import { GlobalNav } from './react-hig';
const SideNav = GlobalNav.SideNav;
const Search = GlobalNav.SideNav.Search;
const SectionList = GlobalNav.SideNav.SectionList;
const Section = GlobalNav.SideNav.SectionList.Section;
const SectionCollapse = GlobalNav.SideNav.SectionList.Section.SectionCollapse;
const Group = GlobalNav.SideNav.SectionList.Section.Group;
const Module = GlobalNav.SideNav.SectionList.Section.Group.Module;
const ModuleCollapse = GlobalNav.SideNav.SectionList.Section.Group.Module.ModuleCollapse;
const Submodule = GlobalNav.SideNav.SectionList.Section.Group.Module.Submodule;

function Context(props) {
    return (
      <GlobalNav>
        <SideNav>
          <SectionList>
            <Section label="Project" title="Runway">
              <Group>
                <Module icon="assets">
                  <SubmoduleAdapter {...props} />
                </Module>
              </Group>
            </Section>
          </SectionList>
        </SideNav>
      </GlobalNav>
    );
  }

You could get to tabs like this:

const Tabs = GlobalNav.SubNav.Tabs;

But if we exported each component at the top level it could look like this instead:

import {
  SideNav,
  Search,
  SectionList,
  Section,
  SectionCollapse,
  Group,
  Module,
  ModuleCollapse,
  Submodule
} from 'react-hig';

Tidier, more conventional, etc.

Is this what you're asking for @camwest ? Can anyone think of a reason not to do this?

camwest commented 7 years ago

Oh I totally forgot tabs wasn't a top level thing. My bad. We can definitely export the tabs at the top level but we need to find a way to communicate the heirarchy constraints... maybe @bernolet has a suggestion?