-
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.
tab visual indicators and minor css fixes
- Loading branch information
1 parent
799b746
commit 690d55d
Showing
7 changed files
with
174 additions
and
83 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
|
||
import { TAB_HEIGHT, TAB_WIDTH, POSITION_INCREMENT } from './hooks'; | ||
|
||
import './index.scss'; | ||
|
||
const GAP = 1; | ||
const DROP_INDICATOR_WIDTH = POSITION_INCREMENT - TAB_WIDTH - (2 * GAP); | ||
|
||
const TabIndicators = ({ | ||
dropIndicatorIndex, | ||
tabCount, | ||
}) => { | ||
const tabShadow = () => ( | ||
<div className='tab-shadow' style={{ width: TAB_WIDTH, height: TAB_HEIGHT }} /> | ||
); | ||
const dropIndicator = (highlight) => ( | ||
<div | ||
className='drop-indicator' | ||
style={{ width: DROP_INDICATOR_WIDTH, height: TAB_HEIGHT, background: highlight ? '#5BC5FF' : 'transparent' }} | ||
/> | ||
); | ||
|
||
let tabIndicators = []; | ||
for (let i = 0; i < tabCount; i++) { | ||
tabIndicators = [ | ||
...tabIndicators, | ||
dropIndicator(i === dropIndicatorIndex), | ||
tabShadow(), | ||
]; | ||
if (i === tabCount - 1) { | ||
tabIndicators = [ | ||
...tabIndicators, | ||
dropIndicator(i === dropIndicatorIndex), | ||
]; | ||
} | ||
} | ||
|
||
return ( | ||
<div | ||
className='tab-indicator-container' | ||
style={{ left: -DROP_INDICATOR_WIDTH - GAP, gap: GAP }} | ||
> | ||
{tabIndicators} | ||
</div> | ||
); | ||
}; | ||
|
||
export default TabIndicators; |
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.