All files / mobile.editor.overlay blockMessageDrawer.js

80% Statements 4/5
100% Branches 0/0
50% Functions 1/2
80% Lines 4/5

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 351x 1x                                           1x 2x                    
var Drawer = require( '../mobile.startup/Drawer' ),
	BlockMessageDetails = require( './BlockMessageDetails' );
 
/**
 * @typedef {Object} BlockMessageOptions
 * @property {number} blockId representing the block
 * @property {boolean} partial is this a partial block?
 * @property {Object} creator
 * @property {string} creator.name of the blocker
 * @property {string} creator.url associated with the block
 * @property {string} reason for block
 * @property {string} [duration] of block e.g. "1 week"
 * @property {string} [expiry] of block, wrapped in parentheses
 *  e.g. "(1st September 2019)"
 */
 
/**
 * This creates the drawer at the bottom of the screen that appears when a
 * blocked user tries to edit.
 *
 * @param {BlockMessageOptions} props
 * @return {Drawer}
 */
module.exports = function blockMessageDrawer( props ) {
	return new Drawer( {
		className: 'drawer block-message',
		onBeforeHide: function ( drawer ) {
			drawer.$el.remove();
		},
		children: [
			( new BlockMessageDetails( props ) ).$el
		]
	} );
};