/* * SonarQube * Copyright (C) 2009-2024 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { ItemDivider, ItemHeader, ItemLink, OpenNewTabIcon } from 'design-system'; import * as React from 'react'; import { translate } from '../../helpers/l10n'; import { getBaseUrl } from '../../helpers/system'; import { SuggestionLink } from '../../types/types'; import { DocItemLink } from './DocItemLink'; import { SuggestionsContext } from './SuggestionsContext'; function IconLink({ icon = 'embed-doc/sq-icon.svg', link, text, }: { icon?: string; link: string; text: string; }) { return ( {text} {text} ); } function Suggestions({ firstItemRef, suggestions, }: { firstItemRef: React.RefObject; suggestions: SuggestionLink[]; }) { return ( <> {translate('docs.suggestion')} {suggestions.map((suggestion, i) => ( {suggestion.text} ))} ); } export function EmbedDocsPopup() { const firstItemRef = React.useRef(null); const { suggestions } = React.useContext(SuggestionsContext); React.useEffect(() => { firstItemRef.current?.focus(); }, []); return ( <> {suggestions.length !== 0 && ( )} {translate('docs.documentation')} {translate('api_documentation.page')} {translate('api_documentation.page.v2')} {translate('docs.get_help')} {translate('docs.stay_connected')} ); }