Autodesk / orion-ui

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

Tabs2 #281

Closed camwest closed 7 years ago

camwest commented 7 years ago

Demonstrates #279

type TabId = string | number;

interface Tabs {
  /**
    * Initial selected tab `id`, for uncontrolled usage.
    */
  defaultSelectedTabId?: TabId;

  /**
   * Selected tab `id`, for controlled usage.
   * Providing this prop will put the component in controlled mode.
   * Unknown ids will result in empty selection (no errors).
     */
  selectedTabId?: TabId;

    /**
     * A callback function that is invoked when a tab in the tab list is clicked.
     */
    onChange?(newTabId: TabId, prevTabId: TabId): void;  
}

interface Tab {
    /**
     * Unique identifier used to control which tab is selected
     * 
     */
    id: TabId;

    /**
     * The tab label
     */
    label: string;  
}

Description

Instead of putting state into the react-hig adapter layer, we should be stricly adhering to the hig.web stateless API and adapting it to React. Once we have low level React Components we can easily create higher level stateful components which are much easier to manage.

Motivation and Context

How Has This Been Tested?

Types of changes

Checklist:

camwest commented 7 years ago

@nfiniteset ping me when you've had a chance to look at this

nfiniteset commented 7 years ago

Looks good to me. 👍