marketplace-elements/README.md

108 строки
2.4 KiB
Markdown
Исходник Обычный вид История

2014-10-06 19:59:52 +04:00
marketplace-elements
====================
2015-01-06 17:28:13 +03:00
Custom HTML elements for Firefox Marketplace.
2014-12-18 00:34:59 +03:00
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
|-----------|-------------|
| theme | Change the color scheme. May be any of the actions defined in [marketplace-frontend](https://github.com/mozilla/fireplace/blob/master/src/media/css/lib/colors.styl) or a light variant. Examples: `"success"` (default) or `"success-light"`. Additionally `"firefox"` may be specified for a gray banner with the Firefox logo. |
| dismiss | Configure dismissal. Values: `"on"` (default), `"off"`, `"remember"`, `"session"`. |
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
------
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.
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>
```
As a modal:
```
<mkt-prompt data-modal>
...
```
### Events
2014-12-18 05:34:56 +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. |