Skip to content

Commit 379e563

Browse files
committed
IconButton: update to interface and named export
1 parent 7b67549 commit 379e563

File tree

6 files changed

+9
-13
lines changed

6 files changed

+9
-13
lines changed

client/common/IconButton.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { render, screen } from '../test-utils';
3-
import IconButton from './IconButton';
3+
import { IconButton } from './IconButton';
44

55
const MockIcon = (props: React.SVGProps<SVGSVGElement>) => (
66
<svg data-testid="mock-icon" {...props} />

client/common/IconButton.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ const ButtonWrapper = styled(Button)`
1111
}
1212
`;
1313

14-
export type IconButtonProps = Omit<
15-
ButtonProps,
16-
'iconBefore' | 'display' | 'focusable'
17-
> & {
14+
export interface IconButtonProps
15+
extends Omit<ButtonProps, 'iconBefore' | 'display' | 'focusable'> {
1816
icon?: ComponentType<{ 'aria-label'?: string }>;
19-
};
17+
}
2018

21-
const IconButton = ({ icon: Icon, ...otherProps }: IconButtonProps) => (
19+
export const IconButton = ({ icon: Icon, ...otherProps }: IconButtonProps) => (
2220
<ButtonWrapper
2321
iconBefore={Icon ? <Icon /> : undefined}
2422
iconOnly
@@ -27,5 +25,3 @@ const IconButton = ({ icon: Icon, ...otherProps }: IconButtonProps) => (
2725
{...otherProps}
2826
/>
2927
);
30-
31-
export default IconButton;

client/components/Dropdown.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import styled from 'styled-components';
44
import { remSize, prop } from '../theme';
5-
import IconButton from '../common/IconButton';
5+
import { IconButton } from '../common/IconButton';
66

77
export const DropdownWrapper = styled.ul`
88
background-color: ${prop('Modal.background')};

client/modules/IDE/components/Editor/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ import EditorAccessibility from '../EditorAccessibility';
7171
import UnsavedChangesIndicator from '../UnsavedChangesIndicator';
7272
import { EditorContainer, EditorHolder } from './MobileEditor';
7373
import { FolderIcon } from '../../../../common/icons';
74-
import IconButton from '../../../../common/IconButton';
74+
import { IconButton } from '../../../../common/IconButton';
7575

7676
emmet(CodeMirror);
7777

client/modules/IDE/components/Header/MobileNav.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useMenuProps } from '../../../../components/Menubar/MenubarSubmenu';
1111
import { ButtonOrLink } from '../../../../common/ButtonOrLink';
1212
import { prop, remSize } from '../../../../theme';
1313
import AsteriskIcon from '../../../../images/p5-asterisk.svg';
14-
import IconButton from '../../../../common/IconButton';
14+
import { IconButton } from '../../../../common/IconButton';
1515
import {
1616
AccountIcon,
1717
AddIcon,

client/modules/User/components/DashboardTabSwitcher.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
44
import { useDispatch } from 'react-redux';
55
import styled from 'styled-components';
66
import { FilterIcon } from '../../../common/icons';
7-
import IconButton from '../../../common/IconButton';
7+
import { IconButton } from '../../../common/IconButton';
88
import { RouterTab } from '../../../common/RouterTab';
99
import { Options } from '../../IDE/components/Header/MobileNav';
1010
import { toggleDirectionForField } from '../../IDE/actions/sorting';

0 commit comments

Comments
 (0)