Last active
July 22, 2017 15:40
-
-
Save ckoster22/489d9b9389a8b3e90549287ca8092240 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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