Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] Use smaller and compressed varients of buttons and form components #352

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions public/components/common/copyable_text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import React, { useCallback, useState, useRef } from 'react';
import { EuiButtonIcon, copyToClipboard, EuiToolTip } from '@elastic/eui';
import { EuiSmallButtonIcon, copyToClipboard, EuiToolTip } from '@elastic/eui';

interface Props {
text: string;
Expand Down Expand Up @@ -33,7 +33,7 @@ export const CopyableText = ({
<div data-test-subj="copyable-text-div">
{iconLeft ? null : text}
<EuiToolTip content={isTextCopied ? copiedTooltipText : tooltipText}>
<EuiButtonIcon
<EuiSmallButtonIcon
buttonRef={copyButtonRef}
aria-label="Copy ID to clipboard"
color="text"
Expand Down
6 changes: 3 additions & 3 deletions public/components/common/options_filter/options_filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
EuiPopover,
EuiPopoverTitle,
EuiFieldSearch,
EuiFilterButton,
EuiSmallFilterButton,
EuiPopoverFooter,
EuiFlexGroup,
EuiFlexItem,
Expand Down Expand Up @@ -73,14 +73,14 @@ export const OptionsFilter = <T extends string | number = string>({
return (
<EuiPopover
button={
<EuiFilterButton
<EuiSmallFilterButton
iconType="arrowDown"
onClick={handleButtonClick}
isSelected={isPopoverOpen}
{...(value.length > 0 ? { hasActiveFilters: true, numActiveFilters: value.length } : {})}
>
{name}
</EuiFilterButton>
</EuiSmallFilterButton>
}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
30 changes: 15 additions & 15 deletions public/components/common/refresh_interval.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

import {
EuiIcon,
EuiButtonEmpty,
EuiFieldText,
EuiSmallButtonEmpty,
EuiCompressedFieldText,
EuiPopover,
EuiFlexGroup,
EuiFieldNumber,
EuiSelect,
EuiButton,
EuiCompressedFieldNumber,
EuiCompressedSelect,
EuiSmallButton,
EuiFlexItem,
EuiFormRow,
EuiCompressedFormRow,
} from '@elastic/eui';
import React, { useEffect, useState, useCallback, useMemo } from 'react';

Expand Down Expand Up @@ -116,14 +116,14 @@ export const RefreshInterval = ({
}, [interval, isPaused, onRefresh, onRefreshChange]);

const intervalButton = (
<EuiButtonEmpty
<EuiSmallButtonEmpty
iconType="arrowDown"
iconSide="right"
onClick={() => setIsPopoverOpen(!isPopoverOpen)}
aria-label="set refresh interval"
>
<EuiIcon type="clock" />
</EuiButtonEmpty>
</EuiSmallButtonEmpty>
);

let errors: string[] = [];
Expand All @@ -132,7 +132,7 @@ export const RefreshInterval = ({
}

return (
<EuiFieldText
<EuiCompressedFieldText
aria-label="current interval value"
readOnly
value={displayedIntervalValue}
Expand All @@ -142,7 +142,7 @@ export const RefreshInterval = ({
isOpen={isPopoverOpen}
closePopover={() => setIsPopoverOpen(false)}
>
<EuiFormRow
<EuiCompressedFormRow
label="Refresh every"
helpText={
errors.length > 0 ? '' : 'Enter an auto-refresh rate greater than 10 seconds.'
Expand All @@ -152,15 +152,15 @@ export const RefreshInterval = ({
>
<EuiFlexGroup>
<EuiFlexItem>
<EuiFieldNumber
<EuiCompressedFieldNumber
aria-label="interval value input"
isInvalid={isInvalid}
value={intervalValue}
onChange={onIntervalValueChange}
/>
</EuiFlexItem>
<EuiFlexItem>
<EuiSelect
<EuiCompressedSelect
aria-label="interval unit selector"
isInvalid={isInvalid}
value={intervalUnit}
Expand All @@ -169,17 +169,17 @@ export const RefreshInterval = ({
/>
</EuiFlexItem>
<EuiFlexItem>
<EuiButton
<EuiSmallButton
aria-label={`${isPaused ? 'start' : 'stop'} refresh interval`}
disabled={isInvalid}
iconType={isPaused ? 'play' : 'stop'}
onClick={() => setIsPaused(!isPaused)}
>
{isPaused ? 'Start' : 'Stop'}
</EuiButton>
</EuiSmallButton>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFormRow>
</EuiCompressedFormRow>
</EuiPopover>
}
/>
Expand Down
6 changes: 3 additions & 3 deletions public/components/monitoring/model_deployment_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Direction,
EuiBasicTable,
EuiButton,
EuiButtonIcon,
EuiSmallButtonIcon,
EuiEmptyPrompt,
EuiHealth,
EuiSpacer,
Expand Down Expand Up @@ -154,7 +154,7 @@ export const ModelDeploymentTable = ({
anchorClassName="ml-modelModelIdCell"
>
{(copy) => (
<EuiButtonIcon
<EuiSmallButtonIcon
aria-label="Copy ID to clipboard"
color="text"
iconType="copy"
Expand All @@ -176,7 +176,7 @@ export const ModelDeploymentTable = ({
render: (id: string, modelDeploymentItem: ModelDeploymentItem) => {
return (
<EuiToolTip content="View status details">
<EuiButtonIcon
<EuiSmallButtonIcon
onClick={() => {
onViewDetail?.(modelDeploymentItem);
}}
Expand Down
4 changes: 2 additions & 2 deletions public/components/monitoring/search_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import React, { useMemo, useCallback } from 'react';
import { EuiFieldSearch } from '@elastic/eui';
import { EuiCompressedFieldSearch } from '@elastic/eui';
import { debounce } from 'lodash';
interface SearchBarProps {
onSearch: (value: string) => void;
Expand All @@ -20,7 +20,7 @@ export const SearchBar = ({ onSearch, inputRef }: SearchBarProps) => {
);

return (
<EuiFieldSearch
<EuiCompressedFieldSearch
autoFocus
inputRef={inputRef}
placeholder="Search by model name or ID"
Expand Down
6 changes: 3 additions & 3 deletions public/components/status_filter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
EuiPopover,
EuiPopoverTitle,
EuiFilterGroup,
EuiFilterButton,
EuiSmallFilterButton,
EuiSelectable,
EuiSelectableOption,
EuiIcon,
Expand Down Expand Up @@ -66,7 +66,7 @@ export const StatusFilter = ({ onUpdateFilters, options, loading }: Props) => {
);

const button = (
<EuiFilterButton
<EuiSmallFilterButton
iconType="arrowDown"
onClick={onButtonClick}
isSelected={isPopoverOpen}
Expand All @@ -76,7 +76,7 @@ export const StatusFilter = ({ onUpdateFilters, options, loading }: Props) => {
isLoading={loading}
>
Status
</EuiFilterButton>
</EuiSmallFilterButton>
);

return (
Expand Down
Loading