8000 fix(vote): add weak to thytype (#474) · atinc/ngx-tethys@2ceb18e · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 2ceb18e

Browse files
ls32140walkerkay
authored andcommitted
fix(vote): add weak to thytype (#474)
* fix(vote): support weak * fix(button-icon): support color * fix(vote): add weak to thytype Co-authored-by: Walker <15701592+walkerkay@users.noreply.github.com>
1 parent 4565c8b commit 2ceb18e

File tree

4 files changed

+12
-29
lines changed

4 files changed

+12
-29
lines changed

demo/src/app/components/+vote/vote.component.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class DemoVoteComponent {
1111
public apiParameters = [
1212
{
1313
property: 'thyVote',
14-
description: '标签类型(primary、success)',
14+
description: '标签类型(primary、success、primary-weak、success-weak)',
1515
type: 'ThyVote',
1616
default: 'primary'
1717
},
@@ -39,12 +39,6 @@ export class DemoVoteComponent {
3939
description: '赞同的数量',
4040
type: 'number | string',
4141
default: ''
42-
},
43-
{
44-
property: 'thyWeak',
45-
description: '是否是弱化样式',
46-
type: 'string | boolean',
47-
default: 'false'
4842
}
4943
];
5044
liveDemos: LiveDemoCodeExample[] = [
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<span
22
class="mt-3"
3-
[thyVote]="'success'"
3+
[thyVote]="'success-weak'"
44
[thyLayout]="'vertical'"
55
[thyVoteCount]="vote_count"
66
[thyHasVoted]="has_voted"
77
thySize="md"
88
(click)="toggleVote($event)"
9-
thyWeak="true"
109
></span>

src/vote/styles/vote.scss

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
background: rgba($color, 0.15);
33
color: $color;
44
&:hover {
5-
background: rgba($color, 0.3) !important;
6-
color: $color !important;
5+
background: rgba($color, 0.2);
6+
color: $color;
77
}
88
&.has-voted {
99
background: $color;
@@ -14,12 +14,16 @@
1414
background-color: $gray-100;
1515
color: $gray-600;
1616
&:hover {
17-
background: $color !important;
18-
color: $white !important;
17+
background: $color;
18+
color: $white;
1919
}
2020
&.has-voted {
2121
background: rgba($color, 0.1);
2222
color: $color;
23+
&:hover {
24+
background: $color;
25+
color: $white;
26+
}
2327
}
2428
}
2529
@mixin vote-variant($height, $padding, $fontSize, $iconSize) {

src/vote/vote.component.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { UpdateHostClassService } from '../shared';
44

55
export type ThySizes = 'sm' | 'md';
66

7-
export type ThyType = 'primary' | 'success';
7+
export type ThyType = 'primary' | 'success' | 'primary-weak' | 'success-weak';
88

99
export type thyLayout = 'vertical' | 'horizontal';
1010

@@ -20,8 +20,6 @@ export class ThyVoteComponent implements OnInit {
2020

2121
_layout: thyLayout;
2222

23-
_isWeak = false;
24-
2523
_initialized = false;
2624

2725
@HostBinding(`class.thy-vote`) class = true;
@@ -52,14 +50,6 @@ export class ThyVoteComponent implements OnInit {
5250
}
5351
}
5452

55-
@Input()
56-
set thyWeak(value: string | boolean) {
57-
this._isWeak = inputValueToBoolean(value);
58-
if (this._initialized) {
59-
this._setClassesByType();
60-
}
61-
}
62-
6353
@Input() thyVoteCount: number | string;
6454

6555
@Input()
@@ -90,11 +80,7 @@ export class ThyVoteComponent implements OnInit {
9080
if (!this._size) {
9181
this._size = 'sm';
9282
}
93-
if (this._isWeak) {
94-
className.push(`thy-vote-${this._type}-weak`);
95-
} else {
96-
className.push(`thy-vote-${this._type}`);
97-
}
83+
className.push(`thy-vote-${this._type}`);
9884
className.push(`thy-vote-${this._layout}`);
9985
className.push(`thy-vote-${this._layout}-size-${this._size}`);
10086
this.updateHostClassService.updateClass(className);

0 commit comments

Comments
 (0)
0