Skip to content

Commit a6e5110

Browse files
committed
Allows to rotate a specific element in the trigger #4
1 parent 3ee6db8 commit a6e5110

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ yarn add @ecodev/fab-speed-dial
4747

4848
| Property | Type | Default | Description |
4949
|------------------|--------------|---------------------|-------------------------------------------------|
50-
| `spin` | `boolean` | `false` | Enables the rotation (360dg) of the trigger action when the speed dial is opening |
50+
| `spin` | `boolean` | `false` | Enables the rotation of the trigger action when the speed dial is opening |
51+
52+
Additionally to spin property, add class "spin180" or "spin360" on html content inside of `eco-fab-speed-dial-trigger` tag to activate rotation on a specific element.
53+
54+
In case of buttons, the icon should rotate not the whole button (box-shadow would rotate too).
5155

5256
## Development
5357

projects/fab-speed-dial/src/lib/fab-speed-dial.scss

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
-webkit-box-direction: $box-direction;
1717
-webkit-flex-direction: $flex-direction;
1818
flex-direction: $flex-direction;
19-
2019
@include eco-fab-speed-dial-box-order($ordinal-group, $order);
2120

2221
& .eco-fab-action-item {
@@ -29,8 +28,12 @@ eco-fab-speed-dial {
2928

3029
&.eco-opened {
3130
.eco-fab-speed-dial-container {
32-
eco-fab-speed-dial-trigger {
33-
&.eco-spin {
31+
eco-fab-speed-dial-trigger.eco-spin {
32+
.spin180 {
33+
-webkit-transform: rotate(180deg);
34+
transform: rotate(180deg);
35+
}
36+
.spin360 {
3437
-webkit-transform: rotate(360deg);
3538
transform: rotate(360deg);
3639
}
@@ -53,18 +56,20 @@ eco-fab-speed-dial {
5356
z-index: 24;
5457

5558
&.eco-spin {
56-
-webkit-transition: all .6s cubic-bezier(.4, 0, .2, 1);
57-
transition: all .6s cubic-bezier(.4, 0, .2, 1);
59+
.spin180, .spin360 {
60+
-webkit-transition: all .6s cubic-bezier(.4, 0, .2, 1);
61+
transition: all .6s cubic-bezier(.4, 0, .2, 1);
62+
}
5863
}
5964
}
6065

6166
eco-fab-speed-dial-actions {
6267
display: -webkit-box;
6368
display: -webkit-flex;
6469
display: flex;
65-
position:absolute;
66-
height:0;
67-
width:0
70+
position: absolute;
71+
height: 0;
72+
width: 0
6873
}
6974
}
7075

@@ -99,8 +104,8 @@ eco-fab-speed-dial {
99104
&.eco-down {
100105

101106
eco-fab-speed-dial-actions {
102-
bottom:2px;
103-
left:7px;
107+
bottom: 2px;
108+
left: 7px;
104109
}
105110

106111
.eco-fab-speed-dial-container {
@@ -118,8 +123,8 @@ eco-fab-speed-dial {
118123

119124
&.eco-up {
120125
eco-fab-speed-dial-actions {
121-
top:2px;
122-
left:7px;
126+
top: 2px;
127+
left: 7px;
123128
}
124129

125130
.eco-fab-speed-dial-container {
@@ -137,8 +142,8 @@ eco-fab-speed-dial {
137142

138143
&.eco-left {
139144
eco-fab-speed-dial-actions {
140-
top:7px;
141-
left:2px;
145+
top: 7px;
146+
left: 2px;
142147
}
143148

144149
.eco-fab-speed-dial-container {
@@ -156,8 +161,8 @@ eco-fab-speed-dial {
156161

157162
&.eco-right {
158163
eco-fab-speed-dial-actions {
159-
top:7px;
160-
right:2px;
164+
top: 7px;
165+
right: 2px;
161166
}
162167

163168
.eco-fab-speed-dial-container {

src/app/app.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
<eco-fab-speed-dial-trigger [spin]="spin">
4343
<button mat-fab (click)="doAction('trigger')">
44-
<mat-icon>add</mat-icon>
44+
<mat-icon class="spin180">add</mat-icon>
4545
</button>
4646
</eco-fab-speed-dial-trigger>
4747

@@ -66,7 +66,7 @@
6666

6767
<eco-fab-speed-dial-trigger [spin]="spin">
6868
<button mat-fab (click)="doAction('trigger')">
69-
<mat-icon>check</mat-icon>
69+
<mat-icon class="spin360">check</mat-icon>
7070
</button>
7171
</eco-fab-speed-dial-trigger>
7272

0 commit comments

Comments
 (0)