Skip to content

Instantly share code, notes, and snippets.

@ckoster22
Last active July 22, 2017 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckoster22/489d9b9389a8b3e90549287ca8092240 to your computer and use it in GitHub Desktop.
Save ckoster22/489d9b9389a8b3e90549287ca8092240 to your computer and use it in GitHub Desktop.
// Hidden types
type TwoTabPanel = {
kind: 'TwoTabPanel',
tab1: Tab,
tab2: Tab
};
type ThreeTabPanel = {
kind: 'ThreeTabPanel',
tab1: Tab,
tab2: Tab,
tab3: Tab
};
type FourTabPanel = {
kind: 'FourTabPanel',
tab1: Tab,
tab2: Tab,
tab3: Tab,
tab4: Tab
};
// Exposed constructor functions
export function twoTabPanel(highlightedBorder: Border, activeIndex: number, { tab1, tab2 }): TabPanelButtonProps {
return {
tabs: {
kind: 'TwoTabPanel',
tab1: tab1,
tab2: tab2
},
highlightedBorder,
activeIndex
};
}
export function threeTabPanel(highlightedBorder: Border, activeIndex: number, { tab1, tab2, tab3 }): TabPanelButtonProps {
// ...
}
export function fourTabPanel(highlightedBorder: Border, activeIndex: number, { tab1, tab2, tab3, tab4 }): TabPanelButtonProps {
// ..
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment