Skip to content

Commit 604874d

Browse files
committed
refactor: remove breaking changes
1 parent 18170d9 commit 604874d

File tree

12 files changed

+17
-75
lines changed

12 files changed

+17
-75
lines changed

packages/colorpickers/src/elements/ColorSwatchDialog/index.spec.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import React, { createRef } from 'react';
99
import userEvent from '@testing-library/user-event';
1010
import { render, screen, act, waitFor } from 'garden-test-utils';
1111
import { ColorSwatchDialog } from './index';
12-
import { COMPONENT_ID } from '../../styled/ColorPickerDialog/StyledButton';
1312

1413
const colors = [
1514
[
@@ -261,7 +260,7 @@ describe('ColorSwatchDialog', () => {
261260
/>
262261
);
263262

264-
expect(getByRole('button')).toHaveAttribute('data-garden-id', COMPONENT_ID);
263+
expect(getByRole('button')).toHaveAttribute('data-garden-id', 'buttons.button');
265264
});
266265
});
267266
});

packages/colorpickers/src/styled/ColorPickerDialog/StyledButton.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@
66
*/
77

88
import styled from 'styled-components';
9-
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9+
import { DEFAULT_THEME } from '@zendeskgarden/react-theming';
1010
import { Button } from '@zendeskgarden/react-buttons';
1111

12-
export const COMPONENT_ID = 'colorpickers.colordialog_button';
13-
1412
/**
1513
* 1. IE11 group width override.
1614
* 2. Input group border overrides.
1715
*/
1816
export const StyledButton = styled(Button as any).attrs({
1917
isNeutral: true,
20-
'data-garden-id': COMPONENT_ID,
2118
'data-garden-version': PACKAGE_VERSION
2219
})`
2320
padding: 0;
@@ -32,8 +29,6 @@ export const StyledButton = styled(Button as any).attrs({
3229
${props => props.theme.borderRadii.md} !important; /* [2] */
3330
/* stylelint-enable */
3431
}
35-
36-
${props => retrieveComponentStyles(COMPONENT_ID, props)};
3732
`;
3833

3934
StyledButton.defaultProps = {

packages/dropdowns/src/elements/menu/Menu.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { render, renderRtl } from 'garden-test-utils';
1010
import userEvent from '@testing-library/user-event';
1111
import { act } from '@testing-library/react';
1212
import { IMenuProps } from '../../types';
13-
import { BTN_COMPONENT_ID, Menu } from './Menu';
13+
import { Menu } from './Menu';
1414
import { ItemGroup } from './ItemGroup';
1515
import { Item } from './Item';
1616
import { Separator } from './Separator';
@@ -667,7 +667,7 @@ describe('Menu', () => {
667667
await floating();
668668
const button = getByRole('button');
669669

670-
expect(button).toHaveAttribute('data-garden-id', BTN_COMPONENT_ID);
670+
expect(button).toHaveAttribute('data-garden-id', 'buttons.button');
671671
});
672672
});
673673
});

packages/dropdowns/src/elements/menu/Menu.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ import { mergeRefs } from 'react-merge-refs';
1111
import { ThemeContext } from 'styled-components';
1212
import { useMenu } from '@zendeskgarden/container-menu';
1313
import { DEFAULT_THEME, useWindow } from '@zendeskgarden/react-theming';
14-
import { IButtonProps } from '@zendeskgarden/react-buttons';
14+
import { Button, IButtonProps } from '@zendeskgarden/react-buttons';
1515
import { IMenuProps, PLACEMENT } from '../../types';
1616
import { MenuContext } from '../../context/useMenuContext';
1717
import { toItems } from './utils';
1818
import { MenuList } from './MenuList';
19-
import { StyledButton } from '../../views';
2019
import ChevronIcon from '@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg';
2120

2221
/**
@@ -87,12 +86,12 @@ export const Menu = forwardRef<HTMLUListElement, IMenuProps>(
8786
typeof button === 'function' ? (
8887
button(triggerProps)
8988
) : (
90-
<StyledButton {...triggerProps}>
89+
<Button {...triggerProps}>
9190
{button}
92-
<StyledButton.EndIcon isRotated={isExpanded}>
91+
<Button.EndIcon isRotated={isExpanded}>
9392
<ChevronIcon />
94-
</StyledButton.EndIcon>
95-
</StyledButton>
93+
</Button.EndIcon>
94+
</Button>
9695
);
9796

9897
const contextValue = useMemo(

packages/dropdowns/src/views/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,4 @@ export * from './menu/StyledItemGroup';
3636
export * from './menu/StyledItemIcon';
3737
export * from './menu/StyledItemMeta';
3838
export * from './menu/StyledItemTypeIcon';
39-
export * from './menu/StyledButton';
4039
export * from './menu/StyledSeparator';

packages/dropdowns/src/views/menu/StyledButton.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/grid/src/elements/pane/components/SplitterButton.spec.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import { Pane } from '../Pane';
1212
import { Splitter } from './Splitter';
1313
import { SplitterButton } from './SplitterButton';
1414

15-
import { COMPONENT_ID } from '../../../styled/pane/StyledPaneSplitterButton';
16-
1715
const UncontrolledTestSplitter = ({ buttonRef }: { buttonRef?: RefObject<HTMLButtonElement> }) => {
1816
return (
1917
<PaneProvider
@@ -57,7 +55,7 @@ describe('SplitterButton', () => {
5755
it('has the correct `data-garden-id`', () => {
5856
const { getByLabelText } = render(<UncontrolledTestSplitter />);
5957

60-
expect(getByLabelText('toggle a')).toHaveAttribute('data-garden-id', COMPONENT_ID);
58+
expect(getByLabelText('toggle a')).toHaveAttribute('data-garden-id', 'buttons.icon_button');
6159
});
6260
});
6361
});

packages/grid/src/styled/pane/StyledPaneSplitterButton.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
*/
77

88
import styled, { css, ThemeProps, DefaultTheme } from 'styled-components';
9-
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9+
import { DEFAULT_THEME } from '@zendeskgarden/react-theming';
1010
import { ChevronButton } from '@zendeskgarden/react-buttons';
1111
import { Orientation } from '../../types';
1212

13-
export const COMPONENT_ID = 'pane.splitter_button';
14-
1513
interface IStyledSplitterButtonProps {
1614
orientation: Orientation;
1715
isRotated: boolean;
@@ -52,7 +50,6 @@ const transformStyles = (props: IStyledSplitterButtonProps & ThemeProps<DefaultT
5250
};
5351

5452
export const StyledPaneSplitterButton = styled(ChevronButton).attrs<IStyledSplitterButtonProps>({
55-
'data-garden-id': COMPONENT_ID,
5653
'data-garden-version': PACKAGE_VERSION,
5754
isBasic: true,
5855
isPill: true,
@@ -61,8 +58,6 @@ export const StyledPaneSplitterButton = styled(ChevronButton).attrs<IStyledSplit
6158
${sizeStyles};
6259
6360
${transformStyles};
64-
65-
${props => retrieveComponentStyles(COMPONENT_ID, props)};
6661
`;
6762

6863
StyledPaneSplitterButton.defaultProps = {

packages/notifications/src/styled/global-alert/StyledGlobalAlertButton.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { render } from 'garden-test-utils';
1010
import { DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
1111

1212
import { TYPE } from '../../types';
13-
import { COMPONENT_ID, StyledGlobalAlertButton } from './StyledGlobalAlertButton';
13+
import { StyledGlobalAlertButton } from './StyledGlobalAlertButton';
1414
import { colorStyles } from './StyledGlobalAlertClose';
1515

1616
jest.mock('./StyledGlobalAlertClose');
@@ -40,7 +40,7 @@ describe('StyledGlobalAlertButton', () => {
4040
it('has the correct `data-garden-id`', () => {
4141
const { container } = render(<StyledGlobalAlertButton alertType="info" />);
4242

43-
expect(container.firstChild).toHaveAttribute('data-garden-id', COMPONENT_ID);
43+
expect(container.firstChild).toHaveAttribute('data-garden-id', 'buttons.button');
4444
});
4545
});
4646
});

packages/notifications/src/styled/global-alert/StyledGlobalAlertButton.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@
66
*/
77

88
import styled, { css, ThemeProps, DefaultTheme } from 'styled-components';
9-
import {
10-
getColorV8,
11-
DEFAULT_THEME,
12-
retrieveComponentStyles,
13-
focusStyles
14-
} from '@zendeskgarden/react-theming';
9+
import { getColorV8, DEFAULT_THEME, focusStyles } from '@zendeskgarden/react-theming';
1510
import { Button } from '@zendeskgarden/react-buttons';
1611

1712
import { IGlobalAlertProps } from '../../types';
1813
import { colorStyles as basicColorStyles } from './StyledGlobalAlertClose';
1914

20-
export const COMPONENT_ID = 'notifications.global-alert.button';
21-
2215
interface IStyledGlobalAlertButtonProps {
2316
alertType: IGlobalAlertProps['type'];
2417
isBasic?: boolean;
@@ -91,7 +84,6 @@ function sizeStyles(props: ThemeProps<DefaultTheme>) {
9184
}
9285

9386
export const StyledGlobalAlertButton = styled(Button).attrs({
94-
'data-garden-id': COMPONENT_ID,
9587
'data-garden-version': PACKAGE_VERSION,
9688
focusInset: false,
9789
isDanger: false,
@@ -105,8 +97,6 @@ export const StyledGlobalAlertButton = styled(Button).attrs({
10597
10698
${sizeStyles};
10799
${colorStyles};
108-
109-
${props => retrieveComponentStyles(COMPONENT_ID, props)};
110100
`;
111101

112102
StyledGlobalAlertButton.defaultProps = {

0 commit comments

Comments
 (0)