Skip to content

Commit 90550af

Browse files
committed
Merge pull request #6 from Polymer/ui-polish
Add focus state for shop-button
2 parents 8501111 + ca753f1 commit 90550af

File tree

5 files changed

+38
-24
lines changed

5 files changed

+38
-24
lines changed

src/shop-button.html

+32-1
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,53 @@
2323
box-sizing: border-box;
2424
border: 2px solid #000;
2525
background-color: #FFF;
26-
font-weight: 500;
2726
font-size: 14px;
27+
font-weight: 500;
2828
color: var(--app-primary-color);
29+
margin: 0;
2930
padding: 8px 44px;
3031
text-align: center;
3132
text-decoration: none;
3233
text-transform: uppercase;
3334
border-radius: 0;
35+
outline: none;
3436
-webkit-appearance: none;
3537
}
3638

39+
shop-button > *:focus {
40+
background-color: #c5cad3;
41+
}
42+
3743
shop-button > *:active {
3844
background-color: #000;
3945
color: #FFF;
4046
}
4147

48+
@media (max-width: 767px) {
49+
50+
/* Responsive buttons are used in shop-detail, shop-cart and shop-checkout */
51+
shop-button[responsive] {
52+
@apply(--layout-fixed-bottom);
53+
height: 64px;
54+
z-index: 1;
55+
}
56+
57+
shop-button[responsive] > * {
58+
background-color: var(--app-accent-color);
59+
border: none;
60+
color: white;
61+
padding: 20px;
62+
width: 100%;
63+
height: 100%;
64+
font-size: 15px;
65+
}
66+
67+
shop-button[responsive] > *:focus {
68+
background-color: var(--app-accent-color);
69+
}
70+
71+
}
72+
4273
</style>
4374
</template>
4475
</dom-module>

src/shop-cart.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ <h1>Your Cart</h1>
6666
</div>
6767
<div class="checkout-box">
6868
Total: <span class="subtotal">[[_formatTotal(total)]]</span>
69-
<shop-button class="action-btn">
69+
<shop-button responsive>
7070
<a href="/checkout">Checkout</a>
7171
</shop-button>
7272
</div>

src/shop-checkout.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ <h2>Order Summary</h2>
382382
<div class="flex">Total</div>
383383
<div>[[_formatPrice(total)]]</div>
384384
</div>
385-
<shop-button class="action-btn" id="submitBox">
385+
<shop-button responsive id="submitBox">
386386
<input type="button" on-tap="_submit" value="Place Order">
387387
</shop-button>
388388
</section>
@@ -394,7 +394,7 @@ <h2>Order Summary</h2>
394394
<header state="success">
395395
<h1>Thanks for your purchase!</h1>
396396
<p>[[response.successMessage]]</p>
397-
<shop-button class="action-btn">
397+
<shop-button responsive>
398398
<a href="/">Finish</a>
399399
</shop-button>
400400
</header>
@@ -403,7 +403,7 @@ <h1>Thanks for your purchase!</h1>
403403
<header state="error">
404404
<h1>We couldn&acute;t process your order</h1>
405405
<p id="errorMessage">[[response.errorMessage]]</p>
406-
<shop-button class="action-btn">
406+
<shop-button responsive>
407407
<a href="/checkout">Try again</a>
408408
</shop-button>
409409
</header>

src/shop-common-styles.html

+1-18
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
font-size: 12px;
3535
}
3636

37-
header > .action-btn {
37+
header > kart-button[responsive] {
3838
margin-top: 20px;
3939
}
4040

@@ -44,23 +44,6 @@
4444
font-size: 1.1em;
4545
}
4646

47-
/* Action Buttons are used in shop-detail, shop-cart and shop-checkout */
48-
.action-btn {
49-
@apply(--layout-fixed-bottom);
50-
height: 64px;
51-
z-index: 1;
52-
}
53-
54-
.action-btn > * {
55-
background-color: var(--app-accent-color);
56-
border: none;
57-
color: white;
58-
padding: 20px;
59-
width: 100%;
60-
height: 100%;
61-
font-size: 15px;
62-
}
63-
6447
}
6548

6649
</style>

src/shop-detail.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ <h1>[[item.title]]</h1>
190190
<h4>Description</h4>
191191
<p id="desc"></p>
192192
</div>
193-
<shop-button class="action-btn">
193+
<shop-button responsive>
194194
<button on-tap="_addToCart" aria-label="Add this item to cart">Add to Cart</button>
195195
</shop-button>
196196
</div>

0 commit comments

Comments
 (0)