Skip to content

Commit

Permalink
feat(Modal): 优化样式,完善 DEMO 页
Browse files Browse the repository at this point in the history
  • Loading branch information
koppthe committed Aug 10, 2018
1 parent 52cb4a2 commit c258eff
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 25 deletions.
12 changes: 7 additions & 5 deletions src/components/modal/action/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@

& > button {
@include flex(auto);
@include line(1);

border: 0;
outline: 0;
min-width: 160px;
height: 88px;
font-size: 28px;
background-color: white;
border-radius: 0;
font-size: $font-size-base;
line-height: 86px;
outline: 0;
border: 0;
border-radius: 0;
background-color: white;

&::after {
border: 0;
Expand Down
6 changes: 4 additions & 2 deletions src/components/modal/content/index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@import "../../../style/theme/default";

.at-modal-content {
min-height: 180px;
color: $color-text-base;
font-size: $font-size-base;
box-sizing: border-box;
font-size: 28px;
color: #333;
}
7 changes: 4 additions & 3 deletions src/components/modal/header/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

.at-modal-header {
@include border-thin-bottom($color-grey-4);
@include line(1);

color: #333;
font-size: 32px;
padding: 20px;
color: $color-text-base;
font-size: $font-size-lg;
padding: $spacing-v-md $spacing-h-lg;
text-align: center;
}
6 changes: 4 additions & 2 deletions src/components/modal/index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@import "../../style/mixins/index.scss";
@import "../../style/theme/default.scss";

$modal-width: 540px;

.at-modal {
position: fixed;
width: 100%;
Expand All @@ -23,9 +25,9 @@
&__container {
@include absolute-center();

width: 540px;
width: $modal-width;
overflow: hidden;
border-radius: 12px;
border-radius: $border-radius-lg;
background-color: $color-white;
}
}
Expand Down
10 changes: 3 additions & 7 deletions src/pages/action/action-sheet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ export default class ActionSheetPage extends Taro.Component {
handleClick = e => {
const { type } = e.currentTarget.dataset

if (type === '1') {
this.setState({ isOpened1: true })
} else if (type === '2') {
this.setState({ isOpened2: true })
} else if (type === '3') {
this.setState({ isOpened3: true })
}
this.setState({
[`isOpened${type}`]: true
})
}

showToast = name => {
Expand Down
19 changes: 13 additions & 6 deletions src/pages/action/modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ export default class ModalPage extends Taro.Component {
})
}

closeModal = name => {
closeModal = (name, msg) => {
this.setState({
[`isOpened${name}`]: false
})

Taro.showToast({
icon: 'none',
title: msg
})
}

render () {
Expand All @@ -44,23 +49,25 @@ export default class ModalPage extends Taro.Component {
<DocsHeader title='Modal 模态框' />

<View className='doc-body'>
{/* 单个按钮 */}
<View className='panel'>
<View className='panel__title'>单个按钮</View>
<View className='panel__content'>
<View className='example-item'>
<AtButton onClick={this.handleClick.bind(this, 'Single')}>
打开单按钮Modal
打开单按钮 Modal
</AtButton>
</View>
</View>
</View>

{/* 多个按钮 */}
<View className='panel'>
<View className='panel__title'>多个按钮</View>
<View className='panel__content'>
<View className='example-item'>
<AtButton onClick={this.handleClick.bind(this, 'Multi')}>
打开多按钮Modal
打开多按钮 Modal
</AtButton>
</View>
</View>
Expand All @@ -77,10 +84,10 @@ export default class ModalPage extends Taro.Component {
</View>
</AtModalContent>
<AtModalAction>
<Button onClick={this.closeModal.bind(this, 'Multi')}>取消</Button>
<Button onClick={this.closeModal.bind(this, 'Multi', '点击了取消')}>取消</Button>
<Button
className='serious-button'
onClick={this.closeModal.bind(this, 'Multi')}
onClick={this.closeModal.bind(this, 'Multi', '点击了确定')}
>
确定
</Button>
Expand All @@ -97,7 +104,7 @@ export default class ModalPage extends Taro.Component {
</View>
</AtModalContent>
<AtModalAction>
<Button onClick={this.closeModal.bind(this, 'Single')}>取消</Button>
<Button onClick={this.closeModal.bind(this, 'Single', '点击了取消')}>取消</Button>
</AtModalAction>
</AtModal>
</View>
Expand Down

0 comments on commit c258eff

Please sign in to comment.