import React from "react";
import * as styles from "./styles";
import { useTracking } from "~/tracking";
import { AnalyticsEvents, TrackingPipelineEvents, } from "~/sdks/NeighborhoodSchools/types";
export const SchoolName = ({ school }) => {
    var _a, _b;
    const tracking = useTracking();
    const schoolURLClicked = () => {
        tracking.postEvent({
            eventType: TrackingPipelineEvents.SCHOOL_URL_CLICKED,
            eventAttributes: [
                {
                    label: "school_name_clicked",
                    data: school.name,
                },
                {
                    label: "school_url_clicked",
                    data: school.url,
                },
            ],
        });
        tracking.trackAnalyticsEvent({
            eventName: AnalyticsEvents.SCHOOL_URL_CLICKED,
            eventAttributes: {
                school_name: school.name,
                school_url: school.url,
            },
        });
    };
    return (React.createElement("div", { className: styles.container },
        school.url ? (React.createElement("a", { onClick: schoolURLClicked, className: styles.schoolName, href: school.url, target: "_blank", rel: "noreferrer", "data-has-link": school.url !== undefined, "data-testid": "school-name-with-link" }, school.name)) : (React.createElement("p", { className: styles.schoolName }, school.name)),
        ((_a = school.school_board_attributes) === null || _a === void 0 ? void 0 : _a.name) && (React.createElement("p", { className: styles.board }, (_b = school.school_board_attributes) === null || _b === void 0 ? void 0 : _b.name))));
};
//# sourceMappingURL=index.js.map