Skip to content

Commit 5297291

Browse files
committedNov 2, 2017
fix(MdSnackbar): adjust margins and padding to be compliant with the specs
1 parent 6c78232 commit 5297291

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
<example src="./examples/Duration.vue" />
1+
<example src="./examples/SnackbarExample.vue" />
22

33
<template>
44
<page-container centered :title="$t('pages.snackbar.title')">
55
<div class="page-container-section">
6-
<p>Lorem ipsum</p>
6+
<p>Snackbars provide brief feedback about an operation through a message at the bottom of the screen.</p>
7+
<p>They can have a custom duration on the screen or be persistent. I can be centered aligned or left aligned.</p>
78
</div>
89

910
<div class="page-container-section">
1011
<h2>Duration and position</h2>
1112

12-
<code-example title="Dynamic values" :component="examples['duration']" />
13+
<code-example title="Dynamic values" :component="examples['snackbar-example']" />
1314

1415
<api-item title="API - md-snackbar">
1516
<p>This component does not have any extra option.</p>
@@ -19,10 +20,10 @@
1920
</template>
2021

2122
<script>
22-
import examples from 'docs-mixins/docsExample'
23+
import examples from 'docs-mixins/docsExample'
2324
24-
export default {
25-
name: 'Snackbar',
26-
mixins: [examples]
27-
}
25+
export default {
26+
name: 'Snackbar',
27+
mixins: [examples]
28+
}
2829
</script>

‎docs/app/pages/Components/Snackbar/examples/Duration.vue ‎docs/app/pages/Components/Snackbar/examples/SnackbarExample.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<script>
3030
export default {
31-
name: 'Duration',
31+
name: 'SnackbarExample',
3232
data: () => ({
3333
showSnackbar: false,
3434
position: 'center',

‎src/components/MdSnackbar/MdSnackbar.vue

+17-5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656

5757
<style lang="scss">
5858
@import "~components/MdAnimation/variables";
59+
@import "~components/MdLayout/mixins";
5960
@import "~components/MdElevation/mixins";
6061
6162
.md-snackbar {
@@ -64,7 +65,7 @@
6465
max-width: 568px;
6566
min-height: 48px;
6667
max-height: 80px;
67-
padding: 0 24px;
68+
padding: 14px 24px;
6869
display: flex;
6970
align-items: center;
7071
position: fixed;
@@ -74,13 +75,14 @@
7475
will-change: background-color, color, opacity, transform;
7576
7677
&.md-position-center {
78+
margin: 0 auto;
79+
right: 0;
7780
bottom: 0;
78-
left: 50%;
79-
transform: translate3D(-50%, 0, 0);
81+
left: 0;
8082
8183
&.md-snackbar-enter,
8284
&.md-snackbar-leave-active {
83-
transform: translate3D(-50%, calc(100% + 8px), 0);
85+
transform: translate3D(0, calc(100% + 8px), 0);
8486
}
8587
}
8688
@@ -93,6 +95,12 @@
9395
transform: translate3D(0, calc(100% + 32px), 0);
9496
}
9597
}
98+
99+
@include md-layout-xsmall {
100+
left: 0;
101+
transform: none;
102+
border-radius: 0;
103+
}
96104
}
97105
98106
.md-snackbar-enter,
@@ -113,7 +121,11 @@
113121
114122
.md-button {
115123
min-width: 0;
116-
margin: 0 -12px 0 12px;
124+
margin: -8px -8px -8px 36px;
125+
126+
@include md-layout-xsmall {
127+
margin-left: 12px;
128+
}
117129
}
118130
}
119131
</style>

0 commit comments

Comments
 (0)