Skip to content

Commit

Permalink
feat(PickerHeader): 优化样式及点击反馈效果
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Oct 4, 2019
1 parent 84c39c7 commit 182acc2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/components/PickerHeader/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
.m-picker-header {
display: flex;
align-items: center;
padding: transformPx(10) transformPx(15);
border-bottom: transformPx(0.5) solid $hairlineColor;
@include hairlineBottom($hairlineColor);

&__cancel {
padding: transformPx(10) transformPx(15);
flex-shrink: 0;
font-size: transformPx(17);
color: $grayColor;
Expand All @@ -16,6 +16,10 @@
opacity: 0;
pointer-events: none;
}

&_active {
opacity: 0.6;
}
}

&__title {
Expand All @@ -28,9 +32,14 @@
}

&__confirm {
padding: transformPx(10) transformPx(15);
flex-shrink: 0;
font-size: transformPx(17);
color: $primaryColor;

&_active {
opacity: 0.6;
}
}
}

7 changes: 6 additions & 1 deletion src/components/PickerHeader/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import Taro from '@tarojs/taro'
import {functionalComponent} from '../component'
import {MPickerHeaderDefaultProps, MPickerHeaderProps} from './props'
import {usePlatform} from '../../hooks'
import {View} from '@tarojs/components'

function MPickerHeader(props: MPickerHeaderProps) {
const platform = usePlatform()

return (
<View className='m-picker-header'>
<View className={`m-picker-header is-${platform}`}>
<View
className={`m-picker-header__cancel ${props.noCancel && 'm-picker-header__cancel_hidden'}`}
hoverClass='m-picker-header__cancel_active'
onClick={props.onCancel}>
{props.cancelText}
</View>
Expand All @@ -17,6 +21,7 @@ function MPickerHeader(props: MPickerHeaderProps) {
</View>
<View
className='m-picker-header__confirm'
hoverClass='m-picker-header__confirm_active'
onClick={props.onConfirm}>
{props.confirmText}
</View>
Expand Down
1 change: 1 addition & 0 deletions src/demo/components/NavigationBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function XNavigationBar(props: XNavigationBarProps) {
return (
<MNavigationBar
homePath={pageUrls.HomeIndex}
noReset={true}
textStyle='white'
backgroundColor='#1AAD19'>
{props.children}
Expand Down

0 comments on commit 182acc2

Please sign in to comment.