Skip to content

Commit b9e8884

Browse files
committed
feat: QToolbarTitle enhancements
1 parent ee786a5 commit b9e8884

File tree

5 files changed

+44
-20
lines changed

5 files changed

+44
-20
lines changed

dev/components/test-layout/layout.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
</q-btn>
1010
<q-toolbar-title>
1111
Quasar Layout
12+
<span slot="subtitle">The Subtiiiitleeee</span>
1213
</q-toolbar-title>
1314
<q-btn flat @click="sides.right = !sides.right">
1415
<q-icon name="menu" />
@@ -19,6 +20,14 @@
1920
<q-checkbox color="white" v-model="todo" />
2021
<q-checkbox color="white" v-model="right" />
2122
</q-toolbar>
23+
<q-toolbar slot="header">
24+
<q-btn flat round small>
25+
<q-icon name="mail" />
26+
</q-btn>
27+
<q-toolbar-title>
28+
Quasar Layout
29+
</q-toolbar-title>
30+
</q-toolbar>
2231

2332
<q-toolbar v-if="todo" slot="header" color="secondary">
2433
<q-search inverted v-model="search" color="none"></q-search>

src/components/toolbar/QToolbar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default {
1515
classes += ` ${prop.inverted ? 'text' : 'bg'}-${prop.color}`
1616
}
1717

18-
ctx.data.staticClass = `q-toolbar row items-center relative-position ${classes}${cls ? ` ${cls}` : ''}`
18+
ctx.data.staticClass = `q-toolbar row no-wrap items-center relative-position ${classes}${cls ? ` ${cls}` : ''}`
1919

2020
return h(
2121
'div',

src/components/toolbar/QToolbarTitle.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ export default {
44
render (h, ctx) {
55
const
66
data = ctx.data,
7-
cls = data.staticClass
7+
cls = data.staticClass,
8+
slots = ctx.slots(),
9+
children = [slots.default]
810

11+
if (slots.subtitle) {
12+
children.push(h('div', { staticClass: 'q-toolbar-subtitle' }, slots.subtitle))
13+
}
914
data.staticClass = `q-toolbar-title${cls ? ` ${cls}` : ''}`
10-
return h(
11-
'div',
12-
ctx.data,
13-
ctx.children
14-
)
15+
16+
return h('div', data, children)
1517
}
1618
}

src/components/toolbar/toolbar.ios.styl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
$toolbar-padding ?= 4px 10px
2-
$toolbar-title-font-size ?= .95rem
3-
$toolbar-title-font-weight ?= 600
4-
$toolbar-title-padding ?= 0 5px
1+
$toolbar-padding ?= 4px 10px
2+
$toolbar-title-font-size ?= 16px
3+
$toolbar-subtitle-font-size ?= 12px
4+
$toolbar-title-font-weight ?= 600
5+
$toolbar-title-padding ?= 0 5px
56

67
.q-toolbar
78
padding $toolbar-padding
@@ -25,13 +26,19 @@ $toolbar-title-padding ?= 0 5px
2526

2627
.q-toolbar-title
2728
flex 1
28-
min-width 0
29+
min-width 1px
2930
max-width 100%
3031
align-items center
3132
font-size $toolbar-title-font-size
3233
font-weight $toolbar-title-font-weight
3334
padding $toolbar-title-padding
35+
text-align center
36+
37+
.q-toolbar-subtitle
38+
font-size $toolbar-subtitle-font-size
39+
opacity .7
40+
41+
.q-toolbar-title, .q-toolbar-subtitle
3442
text-overflow ellipsis
3543
white-space nowrap
3644
overflow hidden
37-
text-align center

src/components/toolbar/toolbar.mat.styl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
$toolbar-padding ?= 4px 12px
2-
$toolbar-title-font-size ?= 1.15rem
3-
$toolbar-title-font-weight ?= 500
4-
$toolbar-title-padding ?= 0 12px
1+
$toolbar-padding ?= 4px 12px
2+
$toolbar-title-font-size ?= 18px
3+
$toolbar-subtitle-font-size ?= 12px
4+
$toolbar-title-font-weight ?= 500
5+
$toolbar-title-padding ?= 0 12px
56

67
.q-toolbar
78
padding $toolbar-padding
@@ -25,12 +26,17 @@ $toolbar-title-padding ?= 0 12px
2526

2627
.q-toolbar-title
2728
flex 1
28-
min-width 0
29+
min-width 1px
2930
max-width 100%
30-
align-items center
3131
font-size $toolbar-title-font-size
3232
font-weight $toolbar-title-font-weight
33+
padding $toolbar-title-padding
34+
35+
.q-toolbar-subtitle
36+
font-size $toolbar-subtitle-font-size
37+
opacity .7
38+
39+
.q-toolbar-title, .q-toolbar-subtitle
3340
text-overflow ellipsis
3441
white-space nowrap
3542
overflow hidden
36-
padding $toolbar-title-padding

0 commit comments

Comments
 (0)