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