|
| 1 | +<link rel="import" href="../bottom-nav/bottom-nav.html"> |
| 2 | +<link rel="import" href="../paper-button/paper-button.html"> |
| 3 | +<link rel="import" href="../paper-ripple/paper-ripple.html"> |
| 4 | +<link rel="import" href="../polymer/polymer.html"> |
| 5 | + |
| 6 | +<!-- |
| 7 | +`bottom-button` is a full width button for mobile. This is typically used as a |
| 8 | +call-to-action button when viewing some inventory on the screen. |
| 9 | +
|
| 10 | +It may be either monochrome or have an inner border. By default the monochrome |
| 11 | +styling is used. The inner border button may be better for conveying a less |
| 12 | +urgent message. |
| 13 | +
|
| 14 | +Example: |
| 15 | +
|
| 16 | + <bottom-button>Add to Cart</bottom-button> |
| 17 | + <bottom-button border>Invite Friends</bottom-button> |
| 18 | +
|
| 19 | +Custom property | Description | Default |
| 20 | +----------------|-------------|---------- |
| 21 | +`--bottom-button` | Mixin applied to the button | `{}` |
| 22 | +`--bottom-button-background-color` | Background color of the button | `--accent-color` |
| 23 | +`--bottom-button-text-color` | Color of the text for monochrome | `--dark-theme-text-color` |
| 24 | +`--bottom-button-inner-background` | Background color of the inner border button | `--light-theme-background-color` |
| 25 | +
|
| 26 | +@demo demo/index.html |
| 27 | +--> |
| 28 | + |
| 29 | +<dom-module id="bottom-button"> |
| 30 | + <template> |
| 31 | + <style is="custom-style"> |
| 32 | + :host { |
| 33 | + display: block; |
| 34 | + |
| 35 | + --paper-button: { |
| 36 | + border-radius: 0; |
| 37 | + margin: 0; |
| 38 | + padding: 0; |
| 39 | + } |
| 40 | + |
| 41 | + @apply(--bottom-button); |
| 42 | + } |
| 43 | + |
| 44 | + paper-button { |
| 45 | + font-weight: 500; |
| 46 | + height: 64px; |
| 47 | + width: 100%; |
| 48 | + } |
| 49 | + |
| 50 | + .monochrome { |
| 51 | + background-color: var(--bottom-button-background-color, --accent-color); |
| 52 | + color: var(--bottom-button-text-color, --dark-theme-text-color); |
| 53 | + } |
| 54 | + |
| 55 | + .border { |
| 56 | + background-color: var(--bottom-button-inner-background, --light-theme-background-color); |
| 57 | + border: 2px solid var(--bottom-button-background-color, --accent-color); |
| 58 | + border-radius: 0; |
| 59 | + color: var(--accent-color); |
| 60 | + height: 49px; |
| 61 | + margin: 15px; |
| 62 | + padding: 15px; |
| 63 | + width: calc(100% - 30px); |
| 64 | + } |
| 65 | + |
| 66 | + .container { |
| 67 | + background-color: var(--bottom-button-inner-background, --light-theme-background-color); |
| 68 | + } |
| 69 | + |
| 70 | + paper-ripple { |
| 71 | + color: var(--bottom-button-background-color, --accent-color); |
| 72 | + z-index: 1; |
| 73 | + } |
| 74 | + </style> |
| 75 | + <bottom-nav fixed> |
| 76 | + <div class="container"> |
| 77 | + <paper-ripple hidden="{{!_setClass(border)}}"></paper-ripple> |
| 78 | + <paper-button class$="{{_setClass(border)}}"> |
| 79 | + <content></content> |
| 80 | + </paper-button> |
| 81 | + </div> |
| 82 | + </bottom-nav> |
| 83 | + </template> |
| 84 | + |
| 85 | + <script> |
| 86 | + Polymer({ |
| 87 | + |
| 88 | + is: 'bottom-button', |
| 89 | + |
| 90 | + properties: { |
| 91 | + border: { |
| 92 | + type: Boolean, |
| 93 | + value: false |
| 94 | + } |
| 95 | + }, |
| 96 | + |
| 97 | + _setClass: function(border) { |
| 98 | + return border ? 'border' : 'monochrome'; |
| 99 | + } |
| 100 | + |
| 101 | + }); |
| 102 | + </script> |
| 103 | +</dom-module> |
0 commit comments