Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. /* @flow */
  2. import React from 'react';
  3.  
  4. type TabModel = {
  5. id: string,
  6. active: boolean,
  7. label: string,
  8. };
  9. type TabProps = {
  10. active: boolean,
  11. label: string,
  12. }
  13. type TabBarProps = {
  14. tabs: TabModel[]
  15. };
  16. type PageProps = {
  17. tabs: TabModel[]
  18. }
  19.  
  20. const Tab = ({ active, label }: TabProps) =>
  21. <li className={active && 'active'}>{label}</li>;
  22.  
  23. const TabBar = ({ tabs }: TabBarProps) =>
  24. <div className="tab-bar">
  25. Tabs:
  26. <ul>
  27. {tabs.map(tab =>
  28. <Tab key={tab.id} active={tab.active} label={tab.label} />,
  29. )}
  30. </ul>
  31. </div>;
  32.  
  33. const Page = ({ tabs }: PageProps) =>
  34. <TabBar tabs={tabs} />;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement