Skip to content

Pidsvynok/react_tabs-js

 
 

Repository files navigation

React Tabs (JS)

Implement the App and Tabs components to render and switch between given tabs.

Here is the working version

  1. Save the selectedTab in the App (the first tab is selected by default);
  2. Implement the Tabs component accepting tabs via props and displaying then as
      with a link per each tab and the content of the selected tab.
    • Each <li> should have a data-cy="Tab".
    • Each link should have a data-cy="TabLink" and a href with a #tab-id (see the markup).
    • Pass the selectedTab as a prop to the Tabs, the specified tab should be selected if possible (otherwise, the first tab is selected).
    • The Tabs should show the content of the selected tab (add an attribute data-cy="TabContent" for testing). Content should be rendered inside the Tabs component.
    • The selected tab (li) should have an is-active class.
    • Pass the onTabSelected callback to the Tabs, it should be called whenever the user selects another tab. (Don't call the callback if the tab was not changed)
    • The callback should receive the data of the selected tab (an object from the array)
    • The App title (h1) should show a text saying Selected tab is Tab 1 (show the title of the selected tab).
    • When the user selects another tab the h1 should be updated accordingly.
    • The Tabs component should be stateless (don't have an internal state, only props).

Instructions

  • Install Prettier Extention and use this VSCode settings to enable format on save.
  • Implement a solution following the React task guideline.
  • Open one more terminal and run tests with npm test to ensure your solution is correct.
  • Replace <your_account> with your Github username in the DEMO LINK and add it to the PR description.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 96.1%
  • HTML 3.5%
  • SCSS 0.4%