Add click switch to Indicator. Add scrollbar to HideScrollbar. Fix scroll down when horizontal scroll bug. Refactor the HideScrollbar. #22
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
.item {
|
.item {
|
||||||
flex: auto;
|
flex: auto;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
.dot {
|
.dot {
|
||||||
width: 10px;
|
width: 10px;
|
||||||
@@ -19,10 +20,15 @@
|
|||||||
color: constants.$font-secondary-color;
|
color: constants.$font-secondary-color;
|
||||||
style: solid;
|
style: solid;
|
||||||
};
|
};
|
||||||
|
transition: all .2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
:hover {
|
||||||
|
background-color: constants.$focus-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.active > * {
|
.active > * {
|
||||||
background-color: constants.$font-secondary-color;
|
background-color: constants.$font-secondary-color !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,3 +2,4 @@ $main-color: #00D4FF;
|
|||||||
$background-color: #F5F5F5;
|
$background-color: #F5F5F5;
|
||||||
$font-main-color: #4D4D4D;
|
$font-main-color: #4D4D4D;
|
||||||
$font-secondary-color: #9E9E9E;
|
$font-secondary-color: #9E9E9E;
|
||||||
|
$focus-color: #DDDDDD
|
||||||
|
|||||||
@@ -126,6 +126,11 @@ const Home: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleIndicatorSwitch = (index: number) => {
|
||||||
|
setCurrentContent(index)
|
||||||
|
handleScrollToContent(index)()
|
||||||
|
}
|
||||||
|
|
||||||
const content = [
|
const content = [
|
||||||
{
|
{
|
||||||
backgroundColor: '#FBFBFB',
|
backgroundColor: '#FBFBFB',
|
||||||
@@ -153,7 +158,11 @@ const Home: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div hidden={navbarHidden} className={'indicator'}>
|
<div hidden={navbarHidden} className={'indicator'}>
|
||||||
<Indicator total={content.length} current={currentContent} />
|
<Indicator
|
||||||
|
total={content.length}
|
||||||
|
current={currentContent}
|
||||||
|
onSwitch={handleIndicatorSwitch}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user