Skip to content

Commit

Permalink
feat(module: swipe-action): add className api (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
BronzeCui authored and Guoyuanqiang committed May 14, 2019
1 parent c09b85e commit 3a976c5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
14 changes: 11 additions & 3 deletions components/swipe-action/demo/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,15 @@ import { Component } from '@angular/core';
</ListItem>
</SwipeAction>
</List>
`
`,
styles : [
`
/deep/.btnClass {
background-color: #F4333C;
color: white
}
`
]
})
export class DemoSwipeActionBasicComponent {
isMobile = /Android|webOS|iPhone|iPod|BlackBerry/i.test(window.navigator.userAgent);
Expand All @@ -92,7 +100,7 @@ export class DemoSwipeActionBasicComponent {
{
text: 'Delete',
onPress: () => console.log('delete'),
style: { backgroundColor: '#F4333C', color: 'white' }
className: 'btnClass'
}
];

Expand All @@ -105,7 +113,7 @@ export class DemoSwipeActionBasicComponent {
{
text: 'long text',
onPress: () => console.log('delete'),
style: { backgroundColor: '#F4333C', color: 'white' }
className: 'btnClass'
}
];

Expand Down
1 change: 1 addition & 0 deletions components/swipe-action/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ Properties | Descrition | Type | Default
| text | text of button | String | `Click` |
| style | style of button | Object | `{}` |
| onPress | callback function that is triggered when button will be pressed | (): void | `function() {}` |
| className | class name of button | String | |

1 change: 1 addition & 0 deletions components/swipe-action/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ subtitle: 滑动操作
| text | 按钮文案 | String | `Click` |
| style | 按钮样式 | Object | `{}` |
| onPress | 按钮点击事件 | (): void | `function() {}` |
| className | 按钮样式类 | String | |

6 changes: 3 additions & 3 deletions components/swipe-action/swipe-action.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class="{{prefixCls}}-actions {{prefixCls}}-actions-left"
#leftBtnRef>
<div *ngFor="let btn of left"
class="{{prefixCls}}-btn"
class="{{prefixCls}}-btn {{btn.className}}"
[ngStyle]="btn.style"
role="button"
(click)="onBtnClick($event, btn)">
Expand All @@ -17,11 +17,11 @@
class="{{prefixCls}}-actions {{prefixCls}}-actions-right"
#rightBtnRef>
<div *ngFor="let btn of right"
class="{{prefixCls}}-btn"
class="{{prefixCls}}-btn {{btn.className}}"
[ngStyle]="btn.style"
role="button"
(click)="onBtnClick($event, btn)"
>
>
<div class="{{prefixCls}}-btn-text">
{{btn.text || 'Click'}}
</div>
Expand Down

0 comments on commit 3a976c5

Please sign in to comment.