Migrate drawer titles to title slot

GlDrawer now exposes a `title` slot to be used solely for rendering a
title while additional actions should be rendered in the existing
`header` slot. This lets us align the close button properly.

Changelog: fixed
parent 9439d20f
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
class="boards-sidebar gl-absolute" class="boards-sidebar gl-absolute"
@close="handleClose" @close="handleClose"
> >
<template #header> <template #title>
<h2 class="gl-my-0 gl-font-size-h2 gl-line-height-24">{{ __('Issue details') }}</h2> <h2 class="gl-my-0 gl-font-size-h2 gl-line-height-24">{{ __('Issue details') }}</h2>
</template> </template>
<template #default> <template #default>
......
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
:open="isSidebarOpen" :open="isSidebarOpen"
@close="unsetActiveId" @close="unsetActiveId"
> >
<template #header>{{ $options.listSettingsText }}</template> <template #title>{{ $options.listSettingsText }}</template>
<template v-if="isSidebarOpen"> <template v-if="isSidebarOpen">
<div v-if="boardListType === ListType.label"> <div v-if="boardListType === ListType.label">
<label class="js-list-label gl-display-block">{{ listTypeTitle }}</label> <label class="js-list-label gl-display-block">{{ listTypeTitle }}</label>
......
...@@ -21,7 +21,7 @@ export default { ...@@ -21,7 +21,7 @@ export default {
</script> </script>
<template> <template>
<gl-drawer class="gl-pt-8" :open="isOpen" @close="$emit('close')"> <gl-drawer class="gl-pt-8" :open="isOpen" @close="$emit('close')">
<template #header>{{ __('Page settings') }}</template> <template #title>{{ __('Page settings') }}</template>
<front-matter-controls :settings="settings" @updateSettings="$emit('updateSettings', $event)" /> <front-matter-controls :settings="settings" @updateSettings="$emit('updateSettings', $event)" />
</gl-drawer> </gl-drawer>
</template> </template>
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
:open="open" :open="open"
@close="closeDrawer" @close="closeDrawer"
> >
<template #header> <template #title>
<h4 class="page-title gl-my-2">{{ __("What's new") }}</h4> <h4 class="page-title gl-my-2">{{ __("What's new") }}</h4>
</template> </template>
<template v-if="features.length"> <template v-if="features.length">
......
...@@ -54,9 +54,12 @@ export default { ...@@ -54,9 +54,12 @@ export default {
:open="isSidebarOpen" :open="isSidebarOpen"
@close="handleClose" @close="handleClose"
> >
<template #title>
<h2 class="gl-my-0 gl-font-size-h2 gl-line-height-24">{{ __('Epic details') }}</h2>
</template>
<template #header> <template #header>
<h2 class="gl-mt-0 gl-mb-3 gl-font-size-h2 gl-line-height-24">{{ __('Epic details') }}</h2>
<sidebar-todo-widget <sidebar-todo-widget
class="gl-mt-3"
:issuable-id="activeBoardItem.fullId" :issuable-id="activeBoardItem.fullId"
:issuable-iid="activeBoardItem.iid" :issuable-iid="activeBoardItem.iid"
:full-path="fullPath" :full-path="fullPath"
......
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
:z-index="$options.Z_INDEX" :z-index="$options.Z_INDEX"
@close="$emit('close')" @close="$emit('close')"
> >
<template #header> <template #title>
<h4 data-testid="dashboard-drawer-title">{{ mergeRequest.title }}</h4> <h4 data-testid="dashboard-drawer-title">{{ mergeRequest.title }}</h4>
</template> </template>
<template v-if="showDrawer" #default> <template v-if="showDrawer" #default>
......
...@@ -233,7 +233,7 @@ export default { ...@@ -233,7 +233,7 @@ export default {
class="requirement-form-drawer" class="requirement-form-drawer"
@close="handleDrawerClose" @close="handleDrawerClose"
> >
<template #header> <template #title>
<h4 v-if="isCreate" class="gl-m-0">{{ __('New Requirement') }}</h4> <h4 v-if="isCreate" class="gl-m-0">{{ __('New Requirement') }}</h4>
<div v-else class="gl-display-flex gl-align-items-center"> <div v-else class="gl-display-flex gl-align-items-center">
<strong class="gl-text-gray-500">{{ reference }}</strong> <strong class="gl-text-gray-500">{{ reference }}</strong>
......
...@@ -141,9 +141,11 @@ export default { ...@@ -141,9 +141,11 @@ export default {
:open="isAlertDrawerOpen" :open="isAlertDrawerOpen"
@close="$emit('deselect-alert')" @close="$emit('deselect-alert')"
> >
<template #title>
<h5 class="gl-my-0">{{ selectedAlert.title }}</h5>
</template>
<template #header> <template #header>
<h5 class="gl-mt-2 gl-mb-5">{{ selectedAlert.title }}</h5> <div class="gl-mt-5">
<div>
<gl-link v-if="hasIssue" :href="alertIssuePath" data-testid="issue-link"> <gl-link v-if="hasIssue" :href="alertIssuePath" data-testid="issue-link">
{{ issueText }} {{ issueText }}
</gl-link> </gl-link>
......
...@@ -57,19 +57,18 @@ export default { ...@@ -57,19 +57,18 @@ export default {
v-bind="$attrs" v-bind="$attrs"
v-on="$listeners" v-on="$listeners"
> >
<template v-if="policy" #title>
<h3 class="gl-my-0">{{ policy.name }}</h3>
</template>
<template v-if="policy" #header> <template v-if="policy" #header>
<div> <gl-button
<h3 class="gl-mb-5 gl-mt-0">{{ policy.name }}</h3> class="gl-mt-5"
<div> data-testid="edit-button"
<gl-button category="primary"
data-testid="edit-button" variant="info"
category="primary" :href="editPolicyPath"
variant="info" >{{ s__('NetworkPolicies|Edit policy') }}</gl-button
:href="editPolicyPath" >
>{{ s__('NetworkPolicies|Edit policy') }}</gl-button
>
</div>
</div>
</template> </template>
<div v-if="policy"> <div v-if="policy">
<component :is="policyComponent" v-if="policyComponent" :value="policy.yaml" /> <component :is="policyComponent" v-if="policyComponent" :value="policy.yaml" />
......
...@@ -9,6 +9,7 @@ exports[`ee/BoardContentSidebar matches the snapshot 1`] = ` ...@@ -9,6 +9,7 @@ exports[`ee/BoardContentSidebar matches the snapshot 1`] = `
> >
Issue details Issue details
</h2> </h2>
<boardsidebartitle-stub /> <boardsidebartitle-stub />
<sidebarassigneeswidget-stub <sidebarassigneeswidget-stub
......
...@@ -59,7 +59,12 @@ describe('ee/BoardContentSidebar', () => { ...@@ -59,7 +59,12 @@ describe('ee/BoardContentSidebar', () => {
store, store,
stubs: { stubs: {
GlDrawer: stubComponent(GlDrawer, { GlDrawer: stubComponent(GlDrawer, {
template: '<div><slot name="header"></slot><slot></slot></div>', template: `
<div>
<slot name="title"></slot>
<slot name="header"></slot>
<slot></slot>
</div>`,
}), }),
BoardEditableItem: true, BoardEditableItem: true,
BoardSidebarTitle: true, BoardSidebarTitle: true,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment