# All files / hypertext hypertext.tsx

100% Statements 11/11
100% Branches 2/2
100% Functions 3/3
100% Lines 11/11

    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
    461x

    1x

    1x
    1x

    1x

    4x

    4x

    4x

    1x
    1x
    1x
     import * as React from "react";
    import * as ReactDOM from "react-dom";
    import Foundation, { HandledProps } from "@microsoft/fast-components-foundation-react";
    import { HypertextHandledProps, HypertextManagedClasses, HypertextUnhandledProps } from "./hypertext.props";
    import { HypertextClassNameContract, ManagedClasses } from "@microsoft/fast-components-class-name-contracts-base";
    import { get } from "lodash-es";

    class Hypertext extends Foundation<
        HypertextHandledProps,
        HypertextUnhandledProps,
        {}
    > {
        public static displayName: string = "Hypertext";

        protected handledProps: HandledProps<HypertextHandledProps> = {
            href: void 0,
            managedClasses: void 0
        };

        /**
         * Renders the component
         */
        public render(): React.ReactElement<HTMLAnchorElement> {
            return (
                <a
                    {...this.unhandledProps()}
                    href={this.props.href || null}
                    className={this.generateClassNames()}
                >
                    {this.props.children}
                </a>
            );
        }

        /**
         * Generates class names
         */
        protected generateClassNames(): string {
            return super.generateClassNames(get(this.props, "managedClasses.hypertext"));
        }
    }

    export default Hypertext;
    export * from "./hypertext.props";
    export { HypertextClassNameContract };