All files / components/empty empty.tsx

100% Statements 9/9
100% Branches 4/4
100% Functions 2/2
100% Lines 9/9

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 413x   3x             6x   6x   6x     6x 6x 6x 6x                                          
import { Component, Prop, h, Host } from "@stencil/core";
 
@Component({
    tag: "ux-w-empty",
    styleUrl: "empty.scss",
    shadow: false
})
export class Empty {
    /** icon name - must exist in the ux-icon list of available icons */
    @Prop() icon: string = "";
    /** optional Link for the button */
    @Prop() link?: string = "";
    /** Text for Link Button */
    @Prop() linkText?: string = "";
 
    render() {
        const baseClass = "ux-w-empty";
        const { icon, link, linkText } = this;
        const hasLink = link !== "" && linkText !== "";
        return (
            <Host class={baseClass}>
                <ux-icon class={`${baseClass}__background`} name={icon} />
                <div class={`${baseClass}__inner`}>
                    <ux-icon class={`${baseClass}__icon`} name={icon} />
                    <div class={`${baseClass}__text`}>
                        <div class={`${baseClass}__text-content`}>
                            <slot />
                        </div>
                        {hasLink && (
                            <ux-button href={link} class={`${baseClass}__link`}>
                                {linkText}
                            </ux-button>
                        )}
                        <slot name="link" />
                    </div>
                </div>
            </Host>
        );
    }
}