File tree Expand file tree Collapse file tree 6 files changed +70
-4
lines changed Expand file tree Collapse file tree 6 files changed +70
-4
lines changed Original file line number Diff line number Diff line change 8
8
"@testing-library/react" : " ^9.3.2" ,
9
9
"@testing-library/user-event" : " ^7.1.2" ,
10
10
"bootstrap" : " ^4.4.1" ,
11
+ "classnames" : " ^2.2.6" ,
11
12
"enzyme" : " ^3.11.0" ,
12
13
"enzyme-adapter-react-16" : " ^1.15.2" ,
13
14
"gh-pages" : " ^2.2.0" ,
Original file line number Diff line number Diff line change @@ -3,13 +3,13 @@ import React from 'react';
3
3
import './styles.scss' ;
4
4
5
5
import Navigation from './Navigation' ;
6
- import Table from './Table ' ;
6
+ import Tabs from './Tabs ' ;
7
7
8
8
function App ( ) {
9
9
return (
10
10
< div className = "App" >
11
11
< Navigation />
12
- < Table />
12
+ < Tabs />
13
13
</ div >
14
14
) ;
15
15
}
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ function TableView({ columns, data }) {
22
22
) ;
23
23
24
24
return (
25
- < Table align = "center" striped hover { ...getTableProps ( ) } >
25
+ < Table align = "center" responsive striped hover { ...getTableProps ( ) } >
26
26
< thead >
27
27
{ headerGroups . map ( headerGroup => (
28
28
< tr { ...headerGroup . getHeaderGroupProps ( ) } >
Original file line number Diff line number Diff line change
1
+ import React , { useState } from 'react' ;
2
+ import {
3
+ TabContent ,
4
+ TabPane ,
5
+ Nav ,
6
+ NavItem ,
7
+ NavLink ,
8
+ Row ,
9
+ Col ,
10
+ Container ,
11
+ } from 'reactstrap' ;
12
+ import classnames from 'classnames' ;
13
+
14
+ import Table from '../Table' ;
15
+
16
+ const Tabs = ( ) => {
17
+ const [ activeTab , setActiveTab ] = useState ( '1' ) ;
18
+
19
+ const toggle = tab => {
20
+ if ( activeTab !== tab ) setActiveTab ( tab ) ;
21
+ } ;
22
+
23
+ return (
24
+ < Container >
25
+ < Nav tabs >
26
+ < NavItem >
27
+ < NavLink
28
+ className = { classnames ( { active : activeTab === '1' } ) }
29
+ onClick = { ( ) => {
30
+ toggle ( '1' ) ;
31
+ } }
32
+ >
33
+ Question List
34
+ </ NavLink >
35
+ </ NavItem >
36
+ < NavItem >
37
+ < NavLink
38
+ className = { classnames ( { active : activeTab === '2' } ) }
39
+ onClick = { ( ) => {
40
+ toggle ( '2' ) ;
41
+ } }
42
+ >
43
+ Moar Tabs
44
+ </ NavLink >
45
+ </ NavItem >
46
+ </ Nav >
47
+ < TabContent activeTab = { activeTab } >
48
+ < TabPane tabId = "1" >
49
+ < Row >
50
+ < Col >
51
+ < Table />
52
+ </ Col >
53
+ </ Row >
54
+ </ TabPane >
55
+ < TabPane tabId = "2" >
56
+ < Row >
57
+ < Col > Tab pane 2</ Col >
58
+ </ Row >
59
+ </ TabPane >
60
+ </ TabContent >
61
+ </ Container >
62
+ ) ;
63
+ } ;
64
+
65
+ export default Tabs ;
Original file line number Diff line number Diff line change @@ -2694,7 +2694,7 @@ class-utils@^0.3.5:
2694
2694
isobject "^3.0.0"
2695
2695
static-extend "^0.1.1"
2696
2696
2697
- classnames@^2.2.3 :
2697
+ classnames@^2.2.3, classnames@^2.2.6 :
2698
2698
version "2.2.6"
2699
2699
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce"
2700
2700
integrity sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==
You can’t perform that action at this time.
0 commit comments