Skip to content

Commit

Permalink
Revert "Make delete button accessible"
Browse files Browse the repository at this point in the history
  • Loading branch information
rschamp authored Aug 8, 2019
1 parent 770f381 commit 445874c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 92 deletions.
6 changes: 0 additions & 6 deletions src/components/delete-button/delete-button.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
user-select: none;
cursor: pointer;
transition: all 0.15s ease-out;
}

.delete-button:focus {
outline: none;
box-shadow: 0px 0px 0px 4px $motion-transparent;
}

.delete-button-visible {
display: flex;
align-items: center;
Expand Down
39 changes: 9 additions & 30 deletions src/components/delete-button/delete-button.jsx
Original file line number Diff line number Diff line change
@@ -1,60 +1,39 @@
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import {defineMessages, injectIntl, intlShape} from 'react-intl';

import styles from './delete-button.css';
import deleteIcon from './icon--delete.svg';

const messages = defineMessages({
delete: {
id: 'gui.deleteButton.delete',
description: 'Title of the button to delete a sprite, costume or sound',
defaultMessage: 'Delete'
}
});

const DeleteButtonComponent = ({
className,
intl,
onClick,
setRef,
tabIndex,
...props
}) => (
const DeleteButton = props => (
<div
aria-label={intl.formatMessage(messages.delete)}
aria-label="Delete"
className={classNames(
styles.deleteButton,
className
props.className
)}
ref={setRef}
role="button"
tabIndex={tabIndex}
onClick={onClick}
{...props}
tabIndex={props.tabIndex}
onClick={props.onClick}
>
<div className={styles.deleteButtonVisible}>
<img
className={styles.deleteIcon}
draggable={false}
src={deleteIcon}
/>
</div>
</div>
);

);

DeleteButtonComponent.propTypes = {
DeleteButton.propTypes = {
className: PropTypes.string,
intl: intlShape,
onClick: PropTypes.func.isRequired,
setRef: PropTypes.func.isRequired,
tabIndex: PropTypes.number
};

DeleteButtonComponent.defaultProps = {
DeleteButton.defaultProps = {
tabIndex: 0
};

export default injectIntl(DeleteButtonComponent);
export default DeleteButton;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';

import DeleteButton from '../../containers/delete-button.jsx';
import DeleteButton from '../delete-button/delete-button.jsx';
import styles from './sprite-selector-item.css';
import {ContextMenuTrigger} from 'react-contextmenu';
import {DangerousMenuItem, ContextMenu, MenuItem} from '../context-menu/context-menu.jsx';
Expand Down
52 changes: 0 additions & 52 deletions src/containers/delete-button.jsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ exports[`SpriteSelectorItemComponent matches snapshot when given a number and de
>
<img
className={undefined}
draggable={false}
src="test-file-stub"
/>
</div>
Expand Down Expand Up @@ -142,7 +141,6 @@ exports[`SpriteSelectorItemComponent matches snapshot when selected 1`] = `
>
<img
className={undefined}
draggable={false}
src="test-file-stub"
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion test/unit/components/sprite-selector-item.test.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {mountWithIntl, shallowWithIntl, componentWithIntl} from '../../helpers/intl-helpers.jsx';
import SpriteSelectorItemComponent from '../../../src/components/sprite-selector-item/sprite-selector-item';
import DeleteButton from '../../../src/containers/delete-button.jsx';
import DeleteButton from '../../../src/components/delete-button/delete-button';

describe('SpriteSelectorItemComponent', () => {
let className;
Expand Down

0 comments on commit 445874c

Please sign in to comment.