All files / ext.wikilambda.app/components/function/editor FunctionEditorField.vue

100% Statements 111/111
100% Branches 0/0
100% Functions 0/0
100% Lines 111/111

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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 1121x 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 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
<!--
	WikiLambda Vue componen for function editor block.
	Contains scaffolding around a function editor block.
 
	@copyright 2020– Abstract Wikipedia team; see AUTHORS.txt
	@license MIT
-->
<template>
	<div class="ext-wikilambda-app-function-editor-field">
		<div class="ext-wikilambda-app-function-editor-field__label">
			<slot name="label"></slot>
			<slot name="tooltip-icon">
				<cdx-icon
					v-if="showTooltip && tooltipIcon"
					v-tooltip:bottom="tooltipMessage"
					class="ext-wikilambda-app-function-editor-field__tooltip-icon"
					:icon="tooltipIcon">
				</cdx-icon>
			</slot>
			<div class="ext-wikilambda-app-function-editor-field__description">
				<slot name="description"></slot>
			</div>
		</div>
		<div class="ext-wikilambda-app-function-editor-field__body">
			<slot name="body"></slot>
		</div>
	</div>
</template>
 
<script>
const { CdxIcon, CdxTooltip } = require( '@wikimedia/codex' );
const { defineComponent } = require( 'vue' );
 
module.exports = exports = defineComponent( {
	name: 'wl-function-editor-field',
	components: {
		'cdx-icon': CdxIcon
	},
	directives: {
		tooltip: CdxTooltip
	},
	props: {
		showTooltip: {
			type: Boolean,
			default: false
		},
		tooltipIcon: {
			type: [ String, Object ],
			default: null,
			required: false
		},
		tooltipMessage: {
			type: String,
			default: null
		}
	}
} );
</script>
 
<style lang="less">
@import '../../../ext.wikilambda.app.variables.less';
 
.ext-wikilambda-app-function-editor-field {
	.ext-wikilambda-app-function-editor-field__label {
		width: @wl-field-label-width;
		display: flex;
		flex-direction: column;
 
		// To style the label element
		& > label {
			line-height: @size-200;
			font-weight: @font-weight-bold;
 
			@media screen and ( max-width: @max-width-breakpoint-mobile ) {
				line-height: inherit;
				margin-bottom: @spacing-25;
			}
 
			// To style the (optional) text
			& > span {
				font-weight: @font-weight-normal;
			}
		}
	}
 
	.ext-wikilambda-app-function-editor-field__description {
		color: @color-subtle;
		font-size: @font-size-small;
		line-height: @line-height-small;
		display: inline-block;
 
		@media screen and ( max-width: @max-width-breakpoint-mobile ) {
			margin-bottom: @spacing-25;
		}
	}
 
	.ext-wikilambda-app-function-editor-field__tooltip-icon {
		margin-left: @spacing-50;
		width: @size-100;
		height: @size-100;
	}
 
	.ext-wikilambda-app-function-editor-field__body {
		width: @wl-field-body-width;
 
		@media screen and ( max-width: @max-width-breakpoint-mobile ) {
			width: 100%;
		}
	}
}
</style>