kibana/packages/kbn-search-index-documents/components/documents_overview.tsx
José Luis González 48f8653279
[Search] Typography fixes to get consistency within Web Crawlers and Connectors sections (#175554)
## Summary

Getting typography consistency and better hierarchy throughout
Connectors and Web Crawlers sections:

- Now all panels have the same title size and gutter:

<img width="421" alt="Screenshot 2024-01-25 at 15 13 27"
src="e98a99e1-b928-4a9e-9004-98fee32e58a5">

<img width="434" alt="Screenshot 2024-01-25 at 15 08 53"
src="d9d14415-a2a4-4778-8b9c-444110024a90">

<img width="1223" alt="Screenshot 2024-01-25 at 15 09 16"
src="79ee934d-278d-4324-8a23-8d5184e2dd82">

- All titles have the same treatment and size:

<img width="1247" alt="Screenshot 2024-01-25 at 15 14 30"
src="e5d52c80-c569-4916-a50b-e09a18002e34">
<img width="1238" alt="Screenshot 2024-01-25 at 15 14 45"
src="6ff3ea2f-195a-4109-96f2-9fd6b826c49b">
<img width="1234" alt="Screenshot 2024-01-25 at 15 14 52"
src="03bf49ea-a268-49ad-9e90-75f6a7e79761">
<img width="1235" alt="Screenshot 2024-01-25 at 15 15 15"
src="b3ed1031-eaaf-4d92-8a7e-c3d7eb124dee">
<img width="1238" alt="Screenshot 2024-01-25 at 15 15 21"
src="809e08a9-a2c2-4a3f-aea2-d97f009e1311">
<img width="1242" alt="Screenshot 2024-01-25 at 15 15 30"
src="a35d7485-45b1-4d98-a131-0d6abce4d87f">


- Overview panels using small size for better font hierarchy 

<img width="1227" alt="Screenshot 2024-01-25 at 15 17 45"
src="81227d4e-bf8b-4b39-9918-92b8b8ed554a">
<img width="1228" alt="Screenshot 2024-01-25 at 15 17 54"
src="042925f0-6ca5-483f-8c7f-8972f458f283">


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
2024-01-26 11:14:07 +01:00

70 lines
2.3 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import {
EuiFieldSearch,
EuiFlexGroup,
EuiFlexItem,
EuiPanel,
EuiSpacer,
EuiTitle,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { ChangeEvent } from 'react';
interface DocumentsProps {
accessControlSwitch?: React.ReactNode;
dataTelemetryIdPrefix: string;
documentComponent: React.ReactNode;
searchQueryCallback: (searchQuery: string) => void;
}
export const DocumentsOverview: React.FC<DocumentsProps> = ({
accessControlSwitch,
dataTelemetryIdPrefix,
documentComponent,
searchQueryCallback,
}) => {
return (
<EuiPanel hasBorder={false} hasShadow={false} paddingSize="none">
<EuiSpacer />
<EuiFlexGroup direction="column">
<EuiFlexItem>
<EuiFlexGroup direction="row" alignItems="center">
<EuiFlexItem className="enterpriseSearchDocumentsHeader" grow={false}>
<EuiTitle size="s">
<h2>
{i18n.translate('searchIndexDocuments.documents.title', {
defaultMessage: 'Browse documents',
})}
</h2>
</EuiTitle>
</EuiFlexItem>
{accessControlSwitch && <EuiFlexItem grow={false}>{accessControlSwitch}</EuiFlexItem>}
<EuiFlexItem>
<EuiFieldSearch
data-telemetry-id={`${dataTelemetryIdPrefix}-documents-searchDocuments`}
placeholder={i18n.translate(
'searchIndexDocuments.documents.searchField.placeholder',
{
defaultMessage: 'Search documents in this index',
}
)}
isClearable
onChange={(event: ChangeEvent<HTMLInputElement>) =>
searchQueryCallback(event.target.value)
}
fullWidth
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>{documentComponent}</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
);
};