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 {
class="boards-sidebar gl-absolute"
@close="handleClose"
>
<template #header>
<template #title>
<h2 class="gl-my-0 gl-font-size-h2 gl-line-height-24">{{ __('Issue details') }}</h2>
</template>
<template #default>
......
......@@ -95,7 +95,7 @@ export default {
:open="isSidebarOpen"
@close="unsetActiveId"
>
<template #header>{{ $options.listSettingsText }}</template>
<template #title>{{ $options.listSettingsText }}</template>
<template v-if="isSidebarOpen">
<div v-if="boardListType === ListType.label">
<label class="js-list-label gl-display-block">{{ listTypeTitle }}</label>
......
......@@ -21,7 +21,7 @@ export default {
</script>
<template>
<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)" />
</gl-drawer>
</template>
......@@ -68,7 +68,7 @@ export default {
:open="open"
@close="closeDrawer"
>
<template #header>
<template #title>
<h4 class="page-title gl-my-2">{{ __("What's new") }}</h4>
</template>
<template v-if="features.length">
......
......@@ -54,9 +54,12 @@ export default {
:open="isSidebarOpen"
@close="handleClose"
>
<template #title>
<h2 class="gl-my-0 gl-font-size-h2 gl-line-height-24">{{ __('Epic details') }}</h2>
</template>
<template #header>
<h2 class="gl-mt-0 gl-mb-3 gl-font-size-h2 gl-line-height-24">{{ __('Epic details') }}</h2>
<sidebar-todo-widget
class="gl-mt-3"
:issuable-id="activeBoardItem.fullId"
:issuable-iid="activeBoardItem.iid"
:full-path="fullPath"
......
......@@ -50,7 +50,7 @@ export default {
:z-index="$options.Z_INDEX"
@close="$emit('close')"
>
<template #header>
<template #title>
<h4 data-testid="dashboard-drawer-title">{{ mergeRequest.title }}</h4>
</template>
<template v-if="showDrawer" #default>
......
......@@ -233,7 +233,7 @@ export default {
class="requirement-form-drawer"
@close="handleDrawerClose"
>
<template #header>
<template #title>
<h4 v-if="isCreate" class="gl-m-0">{{ __('New Requirement') }}</h4>
<div v-else class="gl-display-flex gl-align-items-center">
<strong class="gl-text-gray-500">{{ reference }}</strong>
......
......@@ -141,9 +141,11 @@ export default {
:open="isAlertDrawerOpen"
@close="$emit('deselect-alert')"
>
<template #title>
<h5 class="gl-my-0">{{ selectedAlert.title }}</h5>
</template>
<template #header>
<h5 class="gl-mt-2 gl-mb-5">{{ selectedAlert.title }}</h5>
<div>
<div class="gl-mt-5">
<gl-link v-if="hasIssue" :href="alertIssuePath" data-testid="issue-link">
{{ issueText }}
</gl-link>
......
......@@ -57,19 +57,18 @@ export default {
v-bind="$attrs"
v-on="$listeners"
>
<template v-if="policy" #title>
<h3 class="gl-my-0">{{ policy.name }}</h3>
</template>
<template v-if="policy" #header>
<div>
<h3 class="gl-mb-5 gl-mt-0">{{ policy.name }}</h3>
<div>
<gl-button
data-testid="edit-button"
category="primary"
variant="info"
:href="editPolicyPath"
>{{ s__('NetworkPolicies|Edit policy') }}</gl-button
>
</div>
</div>
<gl-button
class="gl-mt-5"
data-testid="edit-button"
category="primary"
variant="info"
:href="editPolicyPath"
>{{ s__('NetworkPolicies|Edit policy') }}</gl-button
>
</template>
<div v-if="policy">
<component :is="policyComponent" v-if="policyComponent" :value="policy.yaml" />
......
......@@ -9,6 +9,7 @@ exports[`ee/BoardContentSidebar matches the snapshot 1`] = `
>
Issue details
</h2>
<boardsidebartitle-stub />
<sidebarassigneeswidget-stub
......
......@@ -59,7 +59,12 @@ describe('ee/BoardContentSidebar', () => {
store,
stubs: {
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,
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