Skip to content

Commit f2f64b9

Browse files
codenamezjamesrstoenescu
authored andcommitted
Add addressbar-colors docs (quasarframework#2981)
* Add addressbar-colors docs * Update addressbar-color.md
1 parent 8d9284f commit f2f64b9

File tree

5 files changed

+55
-66
lines changed

5 files changed

+55
-66
lines changed

docs/build/md-plugin-image.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Adds class 'doc-img' to images
3+
*/
4+
5+
module.exports = function (md) {
6+
md.renderer.rules.image = (tokens, idx, options, env, self) => {
7+
const token = tokens[idx]
8+
9+
token.attrSet('class', 'doc-img')
10+
return self.renderToken(tokens, idx, options)
11+
}
12+
}

docs/build/md.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const
55
mdPluginToken = require('./md-plugin-token'),
66
mdPluginBlockquote = require('./md-plugin-blockquote'),
77
mdPluginHeading = require('./md-plugin-heading'),
8+
mdPluginImage = require('./md-plugin-image'),
89
mdPluginContainers = require('./md-plugin-containers'),
910
mdPluginTable = require('./md-plugin-table')
1011

@@ -23,6 +24,7 @@ const md = markdownIt(opts)
2324
.use(mdPluginToken)
2425
.use(mdPluginBlockquote)
2526
.use(mdPluginHeading)
27+
.use(mdPluginImage)
2628
.use(mdPluginContainers)
2729
.use(mdPluginTable)
2830

80.7 KB
Loading

docs/src/css/app.styl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,6 @@ body
7575
.doc-h6
7676
font-size 0.8rem
7777
margin 1rem 0
78+
79+
.doc-img
80+
max-width 100%
Lines changed: 38 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,55 @@
11
---
2-
title: Docs
2+
title: Mobile Addressbar Coloring
33
---
4+
Newer mobile browsers have the ability to specify a color for the addressbar, like in the example below.
45

5-
[Internal Link](/docs), [External Link](https://vuejs.org)
6-
7-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer non laoreet eros. `token` Morbi non ipsum ac purus dignissim rutrum. Nulla nec ante congue, rutrum tortor facilisis, aliquet ligula. Fusce vitae odio elit. `/quasar.conf.js`
6+
::: warning
7+
**Note 1.** There isn't yet a Web standard for this so it won't work for all mobile browsers.
8+
**Note 2.** This applies when building a website only. For coloring top bar on a mobile app (built with Cordova wrapper), please refer to [Cordova plugins](https://cordova.apache.org/plugins/).
9+
:::
810

9-
## Heading 2
10-
### Heading 3
11-
#### Heading 4
12-
##### Heading 5
13-
###### Heading 6
11+
![Mobile Addressbar Coloring](/assets/mobile-address-bar-colors.jpg "Mobile Addressbar Coloring")
1412

15-
```
16-
const m = 'lala'
17-
```
13+
## Installation
14+
<doc-installation plugins="AddressbarColor" />
1815

19-
```html
20-
<div>
21-
<q-btn @click="doSomething">Do something</q-btn>
22-
<q-icon name="alarm" />
23-
</div>
24-
```
16+
## Usage
2517

26-
```vue
27-
<template>
28-
<!-- you define your Vue template here -->
29-
</template>
18+
We create boot file to initialize its usage: `$ quasar new boot addressbar-color`. A file is created (`/src/boot/addressbar-color.js`). We edit it:
3019

31-
<script>
32-
// This is where your Javascript goes
33-
// to define your Vue component, which
34-
// can be a Layout, a Page or your own
35-
// component used throughout the app.
20+
```js
21+
// file: /src/boot/addressbar-color.js
22+
import { AddressbarColor } from 'quasar'
3623

37-
export default {
38-
//
24+
export default () => {
25+
AddressbarColor.set('#a2e3fa')
3926
}
40-
</script>
41-
42-
<style>
43-
/* This is where your CSS goes */
44-
</style>
4527
```
4628

47-
| Table Example | Type | Description |
48-
| --- | --- | --- |
49-
| infinite | Boolean | Infinite slides scrolling |
50-
| size | String | Thickness of loading bar. |
51-
52-
> Something...
29+
We then have to tell quasar to use this boot file we just created. To do this we edit the boot section of the quasar config:
30+
```js
31+
// file: /quasar.conf.js
32+
return {
33+
boot: [
34+
'addressbar-color'
35+
]
36+
}
37+
```
5338

54-
::: tip
55-
Some tip
56-
:::
39+
What this does is that it injects some `<meta>` tags into your `index.html` at runtime.
5740

58-
::: warning
59-
Some tip
60-
:::
41+
Because the meta tag doesn't get injected until run time you can dynamically change this color multiple times, based on the page the user is on (by calling the `set` method in the `created()` lifecycle hook on the respective pages):
6142

62-
::: danger
63-
Some tip
64-
:::
6543

66-
::: warning CUSTOM TITLE
67-
Some tip
44+
```js
45+
// a .vue file representing a page
46+
export default {
47+
// ...,
48+
created () {
49+
this.$q.addressbarColor.set('#a2e3fa')
50+
}
51+
}
52+
```
53+
::: tip
54+
Calling `set()` with no parameters will use the primary color.
6855
:::
69-
70-
* Something
71-
* something
72-
* else
73-
* Back
74-
* wee
75-
76-
## Installation
77-
<doc-installation components="QBtn" :plugins="['Meta', 'Cookies']" directives="Ripple" :config="{ notify: 'Notify' }" />
78-
79-
## Usage
80-
<doc-example title="Standard" file="QBtn/Standard" />
81-
82-
## API
83-
<doc-api file="QTh" />

0 commit comments

Comments
 (0)