import {css} from '@emotion/react';
import styled from '@emotion/styled';
import Button from 'sentry/components/button';
import ButtonBar from 'sentry/components/buttonBar';
import {DataSection} from 'sentry/components/events/styles';
import Anchor from 'sentry/components/links/anchor';
import {IconAnchor} from 'sentry/icons/iconAnchor';
import {t} from 'sentry/locale';
import space from 'sentry/styles/space';
import {callIfFunction} from 'sentry/utils/callIfFunction';
type Props = {
children: React.ReactNode;
title: React.ReactNode;
type: string;
actions?: React.ReactNode;
className?: string;
isCentered?: boolean;
raw?: boolean;
showPermalink?: boolean;
toggleRaw?: (enable: boolean) => void;
wrapTitle?: boolean;
};
function scrollToSection(element: HTMLDivElement) {
if (window.location.hash && element) {
const [, hash] = window.location.hash.split('#');
try {
const anchorElement = hash && element.querySelector('div#' + hash);
if (anchorElement) {
anchorElement.scrollIntoView();
}
} catch {
// Since we're blindly taking the hash from the url and shoving
// it into a querySelector, it's possible that this may
// raise an exception if the input is invalid. So let's just ignore
// this instead of blowing up.
// e.g. `document.querySelector('div#=')`
// > Uncaught DOMException: Failed to execute 'querySelector' on 'Document': 'div#=' is not a valid selector.
}
}
}
function EventDataSection({
children,
className,
type,
title,
toggleRaw,
raw = false,
wrapTitle = true,
actions,
isCentered = false,
showPermalink = true,
...props
}: Props) {
const titleNode = wrapTitle ?