All files / ext.wikilambda.app/components/base CustomDialogHeader.vue

100% Statements 75/75
100% Branches 1/1
100% Functions 1/1
100% Lines 75/75

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 761x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 14x 14x 14x 14x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
<!--
	WikiLambda Vue component for a Custom Dialog Header.
 
	@copyright 2020– Abstract Wikipedia team; see AUTHORS.txt
	@license MIT
-->
<template>
	<div class="cdx-dialog__header--default ext-wikilambda-app-custom-dialog-header" data-testid="custom-dialog-header">
		<div class="cdx-dialog__header__title-group ext-wikilambda-app-custom-dialog-header__title-group">
			<h2 class="cdx-dialog__header__title">
				<slot name="title"></slot>
			</h2>
			<p v-if="$slots.subtitle" class="cdx-dialog__header__subtitle">
				<slot name="subtitle"></slot>
			</p>
		</div>
		<div
			class="ext-wikilambda-app-custom-dialog-header__extra"
			:class="{ 'ext-wikilambda-app-custom-dialog-header__extra--has-content': $slots.extra }">
			<slot v-if="$slots.extra" name="extra"></slot>
			<cdx-button
				weight="quiet"
				class="cdx-dialog__header__close-button"
				:aria-label="$i18n( 'wikilambda-dialog-close' ).text()"
				@click="$emit( 'close' )"
			>
				<cdx-icon :icon="icons.cdxIconClose"></cdx-icon>
			</cdx-button>
		</div>
	</div>
</template>
 
<script>
 
const { CdxButton, CdxIcon } = require( '@wikimedia/codex' );
const { defineComponent } = require( 'vue' ),
	icons = require( '../../../lib/icons.json' );
 
module.exports = exports = defineComponent( {
	name: 'wl-custom-dialog-header',
	components: {
		'cdx-button': CdxButton,
		'cdx-icon': CdxIcon
	},
	data: function () {
		return {
			icons
		};
	}
} );
</script>
 
<style lang="less">
@import '../../ext.wikilambda.app.variables.less';
 
.ext-wikilambda-app-custom-dialog-header.cdx-dialog__header--default {
	align-items: flex-start;
	gap: @spacing-100;
 
	.ext-wikilambda-app-custom-dialog-header__title-group.cdx-dialog__header__title-group {
		margin-top: @spacing-12;
	}
 
	.ext-wikilambda-app-custom-dialog-header__extra {
		display: flex;
		align-items: center;
		justify-content: flex-end;
		gap: @spacing-25;
 
		&--has-content {
			margin-top: -@spacing-25;
		}
	}
}
</style>