-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added carousel header for stats segments on player page
- Loading branch information
1 parent
49ed3f4
commit aa15019
Showing
17 changed files
with
351 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* CarouselHeader.css */ | ||
|
||
.carousel-header { | ||
display: flex; | ||
list-style: none; | ||
padding: 1.2em; | ||
margin: 0; | ||
border-bottom: 1px #c0c0c0 solid; | ||
} | ||
|
||
.carousel-item { | ||
flex: 1; | ||
text-align: center; | ||
padding: 0; | ||
cursor: pointer; | ||
transition: 0.3s; | ||
} | ||
|
||
.selected { | ||
font-weight: bold; | ||
color: #333; | ||
} | ||
|
||
.greyed-out { | ||
color: #999; | ||
} | ||
|
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
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
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
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
66 changes: 66 additions & 0 deletions
66
prem-data/src/components/bar-chart/player-carousel-header.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React, {useState} from "react"; | ||
import './bar.css'; | ||
import './carousel-header.css'; | ||
|
||
class Node { | ||
constructor(data) { | ||
this.data = data; | ||
this.next = null; | ||
this.prev = null; | ||
} | ||
} | ||
|
||
class DoublyCircularLinkedList { | ||
constructor() { | ||
this.head = null; | ||
this.tail = null; | ||
} | ||
append(data) { | ||
const newNode = new Node(data); | ||
|
||
if (!this.head) { | ||
this.head = newNode; | ||
this.tail = newNode; | ||
} else { | ||
newNode.prev = this.tail; | ||
this.tail.next = newNode; | ||
this.tail = newNode; | ||
} | ||
|
||
this.tail.next = this.head; | ||
this.head.prev = this.tail; | ||
} | ||
|
||
display() { | ||
if (!this.head) { | ||
console.log('Doubly Circular Linked List is empty.'); | ||
return; | ||
} | ||
|
||
let current = this.head; | ||
do { | ||
console.log(current.data); | ||
current = current.next; | ||
} while (current !== this.head); | ||
} | ||
} | ||
|
||
|
||
|
||
export default function PlayerCarouselHeader({circularLinkedList, selectedNode, setSelectedNode}){ | ||
|
||
const handleTabClickRight = () => { | ||
setSelectedNode(selectedNode ? selectedNode.next : circularLinkedList.head); | ||
}; | ||
const handleTabClickLeft = () => { | ||
setSelectedNode(selectedNode ? selectedNode.prev : circularLinkedList.tail); | ||
}; | ||
|
||
return ( | ||
<ul className="carousel-header"> | ||
<li className="carousel-item greyed-out" onClick={() => {handleTabClickLeft()}}>{selectedNode.prev.data}</li> | ||
<li className="carousel-item selected">{selectedNode.data}</li> | ||
<li className="carousel-item greyed-out" onClick={() => {handleTabClickRight()}}>{selectedNode.next.data}</li> | ||
</ul> | ||
) | ||
} |
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
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
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
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
Oops, something went wrong.