2014-10-06 19:59:52 +04:00
|
|
|
marketplace-elements
|
|
|
|
====================
|
|
|
|
|
2014-12-18 00:34:59 +03:00
|
|
|
Web component UI elements for Firefox Marketplace.
|
|
|
|
|
2014-12-18 04:32:55 +03:00
|
|
|
make install
|
2014-12-18 00:34:59 +03:00
|
|
|
make
|
2014-12-18 04:32:55 +03:00
|
|
|
make serve
|
2014-10-06 19:59:52 +04:00
|
|
|
|
2014-12-18 04:51:39 +03:00
|
|
|
[View Demo](http://mozilla.github.io/marketplace-elements/)
|
|
|
|
|
2014-10-06 19:59:52 +04:00
|
|
|
Banner
|
|
|
|
------
|
|
|
|
|
|
|
|
The banner is used to show messages to users.
|
|
|
|
|
|
|
|
```html
|
|
|
|
<mkt-banner>
|
|
|
|
Hey! You should read this.
|
|
|
|
<a href="#do-something">Perform some action</a>
|
|
|
|
<small>This small text will be hidden on narrow screens.</small>
|
|
|
|
</mkt-banner>
|
|
|
|
```
|
|
|
|
|
|
|
|
### Configuration
|
|
|
|
|
2014-10-06 20:01:26 +04:00
|
|
|
|
2014-10-06 19:59:52 +04:00
|
|
|
| attribute | description |
|
2014-10-06 20:01:26 +04:00
|
|
|
|-----------|-------------|
|
2014-10-06 19:59:52 +04:00
|
|
|
| success | Make it green |
|
|
|
|
| dismiss | Configure dismissal. Values: `"on"` (default), `"off"`, `"remember"`. |
|
2014-10-06 20:14:34 +04:00
|
|
|
|
2014-12-05 05:21:07 +03:00
|
|
|
Segmented
|
|
|
|
---------
|
|
|
|
|
|
|
|
The segmented control acts like a select but provides a horizontal layout.
|
|
|
|
|
|
|
|
```html
|
|
|
|
<mkt-segmented>
|
|
|
|
<select>
|
|
|
|
<option value="1">One</option>
|
|
|
|
<option value="2">Two</option>
|
|
|
|
<option value="3" selected>Three</option>
|
|
|
|
</select>
|
|
|
|
</mkt-segmented>
|
|
|
|
```
|
|
|
|
|
|
|
|
```js
|
|
|
|
document.querySelector('mkt-segmented').value; // "3"
|
|
|
|
```
|
|
|
|
|
2014-10-06 20:14:34 +04:00
|
|
|
Login
|
|
|
|
-----
|
|
|
|
|
|
|
|
A login link. This is pretty basic. It will add the "persona" class to a link.
|
|
|
|
|
|
|
|
```html
|
|
|
|
<mkt-login link>Login!</mkt-login>
|
|
|
|
```
|
|
|
|
|
|
|
|
### Configuration
|
|
|
|
|
|
|
|
| attribute | description |
|
2014-10-06 20:15:05 +04:00
|
|
|
|-----------|-------------|
|
2014-10-06 20:14:34 +04:00
|
|
|
| link | Required. Link is the only supported type right now. |
|
2014-12-18 05:34:56 +03:00
|
|
|
|
|
|
|
|
|
|
|
Prompt
|
|
|
|
------
|
|
|
|
|
2014-12-23 11:34:36 +03:00
|
|
|
A form that can take the form of a page or as a modal. As a page, it
|
|
|
|
has just a submit button. As a modal, it has a cancel and submit button.
|
2014-12-20 00:53:47 +03:00
|
|
|
|
|
|
|
As a page:
|
2014-12-18 05:34:56 +03:00
|
|
|
|
|
|
|
```html
|
|
|
|
<mkt-prompt>
|
|
|
|
<form>
|
|
|
|
<p>What is your name?</p>
|
|
|
|
<textarea name="name"></textarea>
|
2014-12-19 23:46:21 +03:00
|
|
|
<div>
|
|
|
|
<button>Cancel</button>
|
|
|
|
<button>Submit</button>
|
|
|
|
</div>
|
2014-12-18 05:34:56 +03:00
|
|
|
</form>
|
|
|
|
</mkt-prompt>
|
|
|
|
```
|
|
|
|
|
2014-12-20 00:53:47 +03:00
|
|
|
As a modal:
|
|
|
|
|
|
|
|
```
|
|
|
|
<mkt-prompt data-modal>
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
2014-12-23 11:34:36 +03:00
|
|
|
### Events
|
2014-12-18 05:34:56 +03:00
|
|
|
|
2014-12-23 11:34:36 +03:00
|
|
|
| event | description |
|
|
|
|
|-------------------|-------------|
|
|
|
|
| mkt-prompt-cancel | cancel button is clicked |
|
|
|
|
| mkt-prompt-submit | submit button is clicked. Serialized form data is passed in event details. |
|
|
|
|
|
|
|
|
### Configuration
|
|
|
|
|
|
|
|
| attribute | description |
|
|
|
|
|-----------|-------------|
|
|
|
|
| validate | function to determine form validity. Defaults to only call form.checkvalidity. |
|