File tree Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -48,12 +48,30 @@ function App() {
48
48
< section id = "examples" >
49
49
< h2 > Examples</ h2 >
50
50
< menu >
51
- < TabButton onSelect = { ( ) => handleSelect ( 'components' ) } >
51
+ < TabButton
52
+ isSelected = { selectedTopic === 'components' }
53
+ onSelect = { ( ) => handleSelect ( 'components' ) }
54
+ >
52
55
Components
53
56
</ TabButton >
54
- < TabButton onSelect = { ( ) => handleSelect ( 'jsx' ) } > JSX</ TabButton >
55
- < TabButton onSelect = { ( ) => handleSelect ( 'props' ) } > Props</ TabButton >
56
- < TabButton onSelect = { ( ) => handleSelect ( 'state' ) } > State</ TabButton >
57
+ < TabButton
58
+ isSelected = { selectedTopic === 'jsx' }
59
+ onSelect = { ( ) => handleSelect ( 'jsx' ) }
60
+ >
61
+ JSX
62
+ </ TabButton >
63
+ < TabButton
64
+ isSelected = { selectedTopic === 'props' }
65
+ onSelect = { ( ) => handleSelect ( 'props' ) }
66
+ >
67
+ Props
68
+ </ TabButton >
69
+ < TabButton
70
+ isSelected = { selectedTopic === 'state' }
71
+ onSelect = { ( ) => handleSelect ( 'state' ) }
72
+ >
73
+ State
74
+ </ TabButton >
57
75
</ menu >
58
76
{ tabContent }
59
77
</ section >
Original file line number Diff line number Diff line change 1
- export default function TabButton ( { children, onSelect } ) {
1
+ export default function TabButton ( { children, onSelect, isSelected } ) {
2
2
return (
3
3
< li >
4
- < button onClick = { onSelect } > { children } </ button >
4
+ < button className = { isSelected ? 'active' : undefined } onClick = { onSelect } >
5
+ { children }
6
+ </ button >
5
7
</ li >
6
8
) ;
7
9
}
You can’t perform that action at this time.
0 commit comments