From bcca47d54534595422836e3d4650045db6e64cc7 Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Thu, 22 Feb 2024 13:32:27 -0800 Subject: [PATCH] [EuiButtonGroup] Remove unnecessary function from `euiButtonGroupStyles` --- .../button_group/button_group.styles.ts | 20 +++++++++---------- .../button/button_group/button_group.tsx | 7 +++---- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/components/button/button_group/button_group.styles.ts b/src/components/button/button_group/button_group.styles.ts index f044b49e193..e2527fb35cd 100644 --- a/src/components/button/button_group/button_group.styles.ts +++ b/src/components/button/button_group/button_group.styles.ts @@ -11,17 +11,15 @@ import { UseEuiTheme } from '../../../services'; import { logicalCSS } from '../../../global_styling'; import { euiFormVariables } from '../../form/form.styles'; -export const euiButtonGroupStyles = () => { - return { - euiButtonGroup: css` - display: inline-block; - ${logicalCSS('max-width', '100%')} - position: relative; /* Ensures the EuiScreenReaderOnly component is positioned relative to this component */ - `, - fullWidth: css` - display: block; - `, - }; +export const euiButtonGroupStyles = { + euiButtonGroup: css` + display: inline-block; + ${logicalCSS('max-width', '100%')} + position: relative; /* Ensures the EuiScreenReaderOnly component is positioned relative to this component */ + `, + fullWidth: css` + display: block; + `, }; export const euiButtonGroupButtonsStyles = (euiThemeContext: UseEuiTheme) => { diff --git a/src/components/button/button_group/button_group.tsx b/src/components/button/button_group/button_group.tsx index ec820c23409..2cf0064b6c3 100644 --- a/src/components/button/button_group/button_group.tsx +++ b/src/components/button/button_group/button_group.tsx @@ -14,7 +14,7 @@ import React, { ReactNode, } from 'react'; -import { useEuiTheme } from '../../../services'; +import { useEuiMemoizedStyles } from '../../../services'; import { EuiScreenReaderOnly } from '../../accessibility'; import { CommonProps } from '../../common'; @@ -142,10 +142,9 @@ export const EuiButtonGroup: FunctionComponent = ({ type = 'single', ...rest }) => { - const wrapperStyles = euiButtonGroupStyles(); const wrapperCssStyles = [ - wrapperStyles.euiButtonGroup, - isFullWidth && wrapperStyles.fullWidth, + euiButtonGroupStyles.euiButtonGroup, + isFullWidth && euiButtonGroupStyles.fullWidth, ]; const styles = useEuiMemoizedStyles(euiButtonGroupButtonsStyles);