11import SlideBar from './SlideBar' ;
2+ import './style.css'
23import React , { Component } from 'react'
34import { ReactComponent as ArrowDown } from '../../../img/arrowDown.svg'
45import { ReactComponent as CPU } from '../../../img/cpu.svg'
56import { ReactComponent as UnsortedBars } from '../../../img/unsortedBars.svg'
67import { ReactComponent as SortedBars } from '../../../img/sortedBars.svg'
8+ import { ReactComponent as Runner } from '../../../img/running.svg'
9+ import { ReactComponent as Speed } from '../../../img/Speed.svg'
710import { ReactComponent as Key } from '../../../img/key.svg'
811import { CONSTANTS } from '../../../config'
12+
13+
14+
915class Options extends Component {
1016 constructor ( props ) {
1117 super ( props ) ;
1218 this . state = {
13- showAdvanvedOptions : false ,
1419 showProcessingColor : false ,
1520 showDefaultBarColor : false ,
1621 showSortedBarColor : false ,
1722 showMinBarColor : false ,
23+ showDelay : false ,
1824 }
1925
2026 }
2127 render ( ) {
22- const { showAdvancedOptions, showProcessingColor, showDefaultBarColor, showSortedBarColor, showMinBarColor} = this . state ;
23-
28+ const { showProcessingColor, showDefaultBarColor, showSortedBarColor, showMinBarColor, showDelay } = this . state ;
29+ const style = {
30+ height : 400
31+ } ;
2432 return (
2533 < div className = "rounded-md" >
2634
2735 < div className = "w-fit flex space-x-5" >
2836
2937 < div className = "flex flex-col items-center relative space-y-2" >
30- < div className = "p-2 hover:bg-gray-200 rounded-md" onClick = { ( ) => this . setState ( { showDefaultBarColor : ! showDefaultBarColor } ) } >
38+ < div className = "p-2 hover:bg-gray-200 rounded-md peer " onClick = { ( ) => this . setState ( { showDefaultBarColor : ! showDefaultBarColor } ) } >
3139 < UnsortedBars className = "scale-[1.2]" />
3240 </ div >
3341 < div className = { `h-3 w-3 rounded-full` } style = { { backgroundColor : this . props . options . state . options . defaultBarColor } } />
@@ -44,10 +52,11 @@ class Options extends Component {
4452 } />
4553 ) ) }
4654 </ div >
55+ < p className = { `bg-white z-10 inline absolute top-[100%] border-2 p-1 rounded-md hidden peer-hover:block tool-tip-options` } > < p className = "font-bold" > Unsorted</ p > bars color</ p >
4756 </ div >
4857
4958 < div className = "flex flex-col items-center relative space-y-2" >
50- < div className = "p-2 hover:bg-gray-200 rounded-md" onClick = { ( ) => this . setState ( { showSortedBarColor : ! showSortedBarColor } ) } >
59+ < div className = "p-2 hover:bg-gray-200 peer rounded-md" onClick = { ( ) => this . setState ( { showSortedBarColor : ! showSortedBarColor } ) } >
5160 < SortedBars className = "scale-[1.2]" />
5261 </ div >
5362 < div className = { `h-3 w-3 rounded-full` } style = { { backgroundColor : this . props . options . state . options . sortedBarColor } } />
@@ -64,11 +73,12 @@ class Options extends Component {
6473 } />
6574 ) ) }
6675 </ div >
76+ < p className = { `bg-white inline z-10 absolute top-[100%] border-2 p-1 rounded-md hidden peer-hover:block tool-tip-options` } > < p className = "font-bold" > Sorted</ p > bars color</ p >
6777 </ div >
6878
6979
7080 < div className = "flex flex-col items-center relative space-y-2" >
71- < div className = "p-2 hover:bg-gray-200 rounded-md" onClick = { ( ) => this . setState ( { showProcessingColor : ! showProcessingColor } ) } >
81+ < div className = "p-2 hover:bg-gray-200 peer rounded-md" onClick = { ( ) => this . setState ( { showProcessingColor : ! showProcessingColor } ) } >
7282 < CPU className = "scale-[1.2]" />
7383 </ div >
7484 < div className = { `h-3 w-3 rounded-full` } style = { { backgroundColor : this . props . options . state . options . processingColor } } />
@@ -85,11 +95,12 @@ class Options extends Component {
8595 } />
8696 ) ) }
8797 </ div >
98+ < p className = { `bg-white inline z-10 absolute top-[100%] border-2 p-1 rounded-md hidden peer-hover:block tool-tip-options` } > < p className = "font-bold" > Processing</ p > bars color</ p >
8899 </ div >
89100
90101
91102 < div className = "flex flex-col items-center relative space-y-2" >
92- < div className = "p-2 hover:bg-gray-200 rounded-md" onClick = { ( ) => this . setState ( { showMinBarColor : ! showMinBarColor } ) } >
103+ < div className = "p-2 hover:bg-gray-200 peer rounded-md" onClick = { ( ) => this . setState ( { showMinBarColor : ! showMinBarColor } ) } >
93104 < Key className = "scale-[1.2]" />
94105 </ div >
95106 < div className = { `h-3 w-3 rounded-full` } style = { { backgroundColor : this . props . options . state . options . currentMinBarColor } } />
@@ -106,15 +117,42 @@ class Options extends Component {
106117 } />
107118 ) ) }
108119 </ div >
120+ < p className = { `bg-white inline z-10 absolute top-[100%] border-2 p-1 rounded-md hidden peer-hover:block tool-tip-options` } > < p className = "font-bold" > Minimum</ p > bar color</ p >
109121 </ div >
110122
111-
112123
113-
124+ < div className = "flex flex-col items-center relative space-y-2" >
125+ < div className = "p-2 hover:bg-gray-200 peer rounded-md" onClick = { ( ) => this . setState ( { showDelay : ! showDelay } ) } >
126+ < Speed className = "scale-[1.2]" />
127+ </ div >
128+ < p className = "font-semibold text-gray-500" > { this . props . options . state . options ?. delay } ms</ p >
129+ < div className = { `absolute bg-white p-2 rounded-md border-2 top-[100%] space-y-1 ${ showDelay ? "block" : "hidden" } ` } >
130+ < div className = "flex flex-col items-center justify-center" >
131+ < SlideBar mainCanvas = { this . props . options } />
132+ < p className = "" > { this . props . options . state . options ?. delay } </ p >
133+ </ div >
134+ </ div >
135+ < p className = { `bg-white inline z-10 absolute top-[100%] border-2 p-1 rounded-md hidden peer-hover:block tool-tip-options` } > Animation Speed</ p >
136+ </ div >
137+
114138
115-
116139
140+ < div className = "flex flex-col items-center relative space-y-2" >
141+ < div className = { `p-2 hover:bg-gray-200 peer rounded-md` } onClick = { ( ) => {
142+ this . props . options . setState ( prev => ( { options : { ...prev . options , skipJ : ! this . props . options . state . options . skipJ } } ) )
143+
144+ } } >
145+ < Runner className = "scale-[1.2]" />
146+ </ div >
147+ < p className = "font-semibold text-gray-500" > { this . props . options . state . options . skipJ ? "ON" : "OFF" } </ p >
148+ < p className = { `bg-white inline z-10 absolute top-[100%] border-2 p-1 rounded-md hidden peer-hover:block tool-tip-options` } > Faster Animation</ p >
149+ </ div >
150+
151+
152+
117153
154+
155+
118156
119157
120158 { /* <p>Default bar color</p>
0 commit comments