Skip to content

Commit

Permalink
Use smaller and compressed varients of buttons and form components (#370
Browse files Browse the repository at this point in the history
) (#377)

* Use EuiSmallButton



* Use EuiSmallButtonIcon



* Use EuiSmallButtonEmpty



* Use EuiCompressedFormRow



* Use EuiCompressedField*



* Use EuiCompressedSelect and EuiCompressedSuperSelect



* Use EuiCompressedRadio and EuiCompressedRadioGroup



* Use EuiCompressedComboBox



* Undo unnecessary EuiSmallButton* uses



* Update snapshots and tests



* Fix pre-existing linting errors



---------


(cherry picked from commit f3b678d)

Signed-off-by: Miki <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 5eca71b commit 56172fb
Show file tree
Hide file tree
Showing 39 changed files with 528 additions and 525 deletions.
3 changes: 2 additions & 1 deletion common/utils/toast_helper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import {
EuiSmallButton,
EuiButton,
EuiCodeBlock,
EuiModal,
Expand Down Expand Up @@ -61,7 +62,7 @@ const loadErrorModal = (errorDetailsMessage: string) => {
</EuiCodeBlock>
</EuiModalBody>
<EuiModalFooter>
<EuiButton onClick={() => modal.close()}>Close</EuiButton>
<EuiSmallButton onClick={() => modal.close()}>Close</EuiSmallButton>
</EuiModalFooter>
</EuiModal>
)
Expand Down
72 changes: 36 additions & 36 deletions public/components/Main/__snapshots__/main.test.tsx.snap

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions public/components/Main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import {
EuiButton,
EuiSmallButton,
EuiButtonIcon,
EuiCallOut,
EuiComboBoxOptionOption,
Expand Down Expand Up @@ -1132,9 +1132,9 @@ export class Main extends React.Component<MainProps, MainState> {
<EuiSpacer />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton href={link} target="_blank" iconType="popout" iconSide="right">
<EuiSmallButton href={link} target="_blank" iconType="popout" iconSide="right">
{linkTitle}
</EuiButton>
</EuiSmallButton>
</EuiFlexItem>
</EuiFlexGroup>
<EuiPageContentBody>
Expand Down
31 changes: 16 additions & 15 deletions public/components/PPLPage/PPLPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import {
EuiButton,
EuiSmallButton,
EuiCodeBlock,
EuiCodeEditor,
EuiComboBoxOptionOption,
Expand Down Expand Up @@ -91,9 +91,9 @@ export class PPLPage extends React.Component<PPLPageProps, PPLPageState> {
</EuiModalBody>

<EuiModalFooter>
<EuiButton onClick={closeModal} fill>
<EuiSmallButton onClick={closeModal} fill>
Close
</EuiButton>
</EuiSmallButton>
</EuiModalFooter>
</EuiModal>
</EuiOverlayMask>
Expand Down Expand Up @@ -125,19 +125,16 @@ export class PPLPage extends React.Component<PPLPageProps, PPLPageState> {
/>
<EuiSpacer />
<EuiFlexGroup className="action-container" gutterSize="m">
<EuiFlexItem
className="sql-editor-buttons"
grow={false}
>
<EuiButton
<EuiFlexItem className="sql-editor-buttons" grow={false}>
<EuiSmallButton
fill={true}
data-test-subj="pplRunButton"
className="sql-editor-button"
isLoading={this.props.asyncLoading}
onClick={() => this.props.onRun(this.props.pplQuery)}
>
{this.props.asyncLoading ? 'Running' : 'Run'}
</EuiButton>
</EuiSmallButton>
</EuiFlexItem>
<EuiFlexItem
grow={false}
Expand All @@ -146,26 +143,30 @@ export class PPLPage extends React.Component<PPLPageProps, PPLPageState> {
this.props.onClear();
}}
>
<EuiButton className="sql-editor-button" data-test-subj="pplClearButton" isDisabled={this.props.asyncLoading}>
<EuiSmallButton
className="sql-editor-button"
data-test-subj="pplClearButton"
isDisabled={this.props.asyncLoading}
>
Clear
</EuiButton>
</EuiSmallButton>
</EuiFlexItem>
{this.props.selectedDatasource &&
this.props.selectedDatasource[0].label === 'OpenSearch' ? (
<EuiFlexItem grow={false} onClick={() => this.props.onTranslate(this.props.pplQuery)}>
<EuiButton
<EuiSmallButton
className="sql-editor-button"
onClick={showModal}
isDisabled={this.props.asyncLoading}
>
Explain
</EuiButton>
</EuiSmallButton>
</EuiFlexItem>
) : (
<EuiFlexItem grow={false} onClick={() => this.props.updatePPLQueries(SAMPLE_PPL_QUERY)}>
<EuiButton className="sql-editor-button" isDisabled={this.props.asyncLoading}>
<EuiSmallButton className="sql-editor-button" isDisabled={this.props.asyncLoading}>
Sample Query
</EuiButton>
</EuiSmallButton>
</EuiFlexItem>
)}
</EuiFlexGroup>
Expand Down
30 changes: 15 additions & 15 deletions public/components/PPLPage/__snapshots__/PPLPage.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ exports[`<PPLPage /> spec renders the component 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero sql-editor-buttons"
>
<button
class="euiButton euiButton--primary euiButton--fill sql-editor-button"
class="euiButton euiButton--primary euiButton--small euiButton--fill sql-editor-button"
data-test-subj="pplRunButton"
type="button"
>
Expand All @@ -157,7 +157,7 @@ exports[`<PPLPage /> spec renders the component 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary sql-editor-button"
class="euiButton euiButton--primary euiButton--small sql-editor-button"
data-test-subj="pplClearButton"
type="button"
>
Expand All @@ -176,7 +176,7 @@ exports[`<PPLPage /> spec renders the component 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary sql-editor-button"
class="euiButton euiButton--primary euiButton--small sql-editor-button"
type="button"
>
<span
Expand Down Expand Up @@ -333,7 +333,7 @@ exports[`<PPLPage /> spec tests the Sample query button 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero sql-editor-buttons"
>
<button
class="euiButton euiButton--primary euiButton--fill sql-editor-button"
class="euiButton euiButton--primary euiButton--small euiButton--fill sql-editor-button"
data-test-subj="pplRunButton"
type="button"
>
Expand All @@ -352,7 +352,7 @@ exports[`<PPLPage /> spec tests the Sample query button 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary sql-editor-button"
class="euiButton euiButton--primary euiButton--small sql-editor-button"
data-test-subj="pplClearButton"
type="button"
>
Expand All @@ -371,7 +371,7 @@ exports[`<PPLPage /> spec tests the Sample query button 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary sql-editor-button"
class="euiButton euiButton--primary euiButton--small sql-editor-button"
type="button"
>
<span
Expand Down Expand Up @@ -528,7 +528,7 @@ exports[`<PPLPage /> spec tests the Sample query button 2`] = `
class="euiFlexItem euiFlexItem--flexGrowZero sql-editor-buttons"
>
<button
class="euiButton euiButton--primary euiButton--fill sql-editor-button"
class="euiButton euiButton--primary euiButton--small euiButton--fill sql-editor-button"
data-test-subj="pplRunButton"
type="button"
>
Expand All @@ -547,7 +547,7 @@ exports[`<PPLPage /> spec tests the Sample query button 2`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary sql-editor-button"
class="euiButton euiButton--primary euiButton--small sql-editor-button"
data-test-subj="pplClearButton"
type="button"
>
Expand All @@ -566,7 +566,7 @@ exports[`<PPLPage /> spec tests the Sample query button 2`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary sql-editor-button"
class="euiButton euiButton--primary euiButton--small sql-editor-button"
type="button"
>
<span
Expand Down Expand Up @@ -723,7 +723,7 @@ exports[`<PPLPage /> spec tests the action buttons 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero sql-editor-buttons"
>
<button
class="euiButton euiButton--primary euiButton--fill sql-editor-button"
class="euiButton euiButton--primary euiButton--small euiButton--fill sql-editor-button"
data-test-subj="pplRunButton"
type="button"
>
Expand All @@ -742,7 +742,7 @@ exports[`<PPLPage /> spec tests the action buttons 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary sql-editor-button"
class="euiButton euiButton--primary euiButton--small sql-editor-button"
data-test-subj="pplClearButton"
type="button"
>
Expand All @@ -761,7 +761,7 @@ exports[`<PPLPage /> spec tests the action buttons 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary sql-editor-button"
class="euiButton euiButton--primary euiButton--small sql-editor-button"
type="button"
>
<span
Expand Down Expand Up @@ -921,7 +921,7 @@ exports[`<PPLPage /> spec tests the action buttons 2`] = `
class="euiFlexItem euiFlexItem--flexGrowZero sql-editor-buttons"
>
<button
class="euiButton euiButton--primary euiButton--fill sql-editor-button"
class="euiButton euiButton--primary euiButton--small euiButton--fill sql-editor-button"
data-test-subj="pplRunButton"
type="button"
>
Expand All @@ -940,7 +940,7 @@ exports[`<PPLPage /> spec tests the action buttons 2`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary sql-editor-button"
class="euiButton euiButton--primary euiButton--small sql-editor-button"
data-test-subj="pplClearButton"
type="button"
>
Expand All @@ -959,7 +959,7 @@ exports[`<PPLPage /> spec tests the action buttons 2`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary sql-editor-button"
class="euiButton euiButton--primary euiButton--small sql-editor-button"
type="button"
>
<span
Expand Down
4 changes: 2 additions & 2 deletions public/components/QueryResults/QueryResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SortableProperties, SortableProperty } from '@elastic/eui/lib/services'
import {
Comparators,
EuiButton,
EuiButtonIcon,
EuiSmallButtonIcon,
EuiComboBoxOptionOption,
EuiContextMenuItem,
EuiContextMenuPanel,
Expand Down Expand Up @@ -317,7 +317,7 @@ export class QueryResults extends React.Component<QueryResultsProps, QueryResult
<EuiFlexItem grow={false}>
{this.props.queryResults.length > 0 &&
(this.props.isResultFullScreen ? (
<EuiButtonIcon
<EuiSmallButtonIcon
iconType="cross"
color="text"
id="exit-fullscreen-button"
Expand Down
11 changes: 6 additions & 5 deletions public/components/QueryResults/QueryResultsBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import { SortableProperties } from '@elastic/eui/lib/services';
// @ts-ignore
import {
Comparators,
EuiSmallButton,
EuiButton,
EuiButtonIcon,
EuiSmallButtonIcon,
EuiCodeEditor,
EuiComboBoxOptionOption,
EuiContextMenu,
Expand Down Expand Up @@ -190,9 +191,9 @@ class QueryResultsBody extends React.Component<QueryResultsBodyProps, QueryResul
</EuiModalBody>

<EuiModalFooter>
<EuiButton onClick={closeModal} fill>
<EuiSmallButton onClick={closeModal} fill>
Close
</EuiButton>
</EuiSmallButton>
</EuiModalFooter>
</EuiModal>
</EuiOverlayMask>
Expand Down Expand Up @@ -404,7 +405,7 @@ class QueryResultsBody extends React.Component<QueryResultsBodyProps, QueryResul

addExpandingNodeIcon(node: Node, expandedRowMap: ItemIdToExpandedRowMap) {
return (
<EuiButtonIcon
<EuiSmallButtonIcon
style={{ marginLeft: -4 }}
onClick={() => this.toggleNodeData(node, expandedRowMap)}
aria-label={
Expand All @@ -426,7 +427,7 @@ class QueryResultsBody extends React.Component<QueryResultsBodyProps, QueryResul
return;
}
return (
<EuiButtonIcon
<EuiSmallButtonIcon
onClick={() => this.updateExpandedRowMap(node, expandedRowMap)}
aria-label={
expandedRowMap[node.parent!.nodeId] &&
Expand Down
Loading

0 comments on commit 56172fb

Please sign in to comment.