Skip to content

Commit 3af5b6d

Browse files
committed
add snackbar link and fix snackbar with fab
1 parent ab7789f commit 3af5b6d

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

docs/src/App.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@
9999
<router-link exact to="/components/sidenav">Sidenav</router-link>
100100
</md-list-item>
101101

102-
<!-- <md-list-item class="md-inset">
102+
<md-list-item class="md-inset">
103103
<router-link exact to="/components/snackbar">Snackbar</router-link>
104-
</md-list-item> -->
104+
</md-list-item>
105105

106106
<md-list-item class="md-inset">
107107
<router-link exact to="/components/spinner">Spinner</router-link>
@@ -303,7 +303,7 @@
303303
transition: $swift-ease-out;
304304
305305
.main-content {
306-
transform: translate3D(0, 7%, 0);
306+
transform: translate3D(0, 10%, 0);
307307
}
308308
}
309309

docs/src/pages/components/Snackbar.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@
163163
</example-box>
164164
</div>
165165
</docs-component>
166+
167+
<md-button class="md-fab md-fab-bottom-right">
168+
<md-icon>add</md-icon>
169+
</md-button>
166170
</page-content>
167171
</template>
168172

src/components/mdButton/mdButton.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,38 +149,44 @@ $button-icon-size: 40px;
149149
position: absolute;
150150
top: 16px;
151151
left: 16px;
152+
z-index: 10;
152153
}
153154

154155
&.md-fab-top-center {
155156
position: absolute;
156157
top: 16px;
157158
left: 50%;
159+
z-index: 10;
158160
transform: translateX(-50%);
159161
}
160162

161163
&.md-fab-top-right {
162164
position: absolute;
163165
top: 16px;
164166
right: 16px;
167+
z-index: 10;
165168
}
166169

167170
&.md-fab-bottom-left {
168171
position: absolute;
169172
bottom: 16px;
170173
left: 16px;
174+
z-index: 10;
171175
}
172176

173177
&.md-fab-bottom-center {
174178
position: absolute;
175179
bottom: 16px;
176180
left: 50%;
177181
transform: translateX(-50%);
182+
z-index: 10;
178183
}
179184

180185
&.md-fab-bottom-right {
181186
position: absolute;
182187
right: 16px;
183188
bottom: 16px;
189+
z-index: 10;
184190
}
185191

186192
&.md-mini {

src/components/mdSnackbar/mdSnackbar.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
active: false,
3636
rootElement: {},
3737
snackbarElement: {},
38+
directionClass: null,
3839
closeTimeout: null
3940
};
4041
},
@@ -44,11 +45,24 @@
4445
'md-active': this.active
4546
};
4647
47-
cssClasses['md-position-' + this.mdPosition.replace(/ /g, '-')] = true;
48+
this.directionClass = this.mdPosition.replace(/ /g, '-');
49+
50+
cssClasses['md-position-' + this.directionClass] = true;
4851
4952
return cssClasses;
5053
}
5154
},
55+
watch: {
56+
active(active) {
57+
const cssClass = 'md-has-toast-' + this.directionClass;
58+
59+
if (active) {
60+
document.body.classList.add(cssClass);
61+
} else {
62+
document.body.classList.remove(cssClass);
63+
}
64+
}
65+
},
5266
methods: {
5367
removeElement() {
5468
this.rootElement.removeChild(this.snackbarElement);

0 commit comments

Comments
 (0)