types_de_champ_editor: add title to actions

This commit is contained in:
Pierre de La Morinerie 2019-04-03 15:15:35 +00:00
parent d79fee7040
commit 253008e666
2 changed files with 14 additions and 4 deletions

View file

@ -2,9 +2,14 @@ import React from 'react';
import PropTypes from 'prop-types';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
function MoveButton({ isEnabled, icon, onClick }) {
function MoveButton({ isEnabled, icon, title, onClick }) {
return (
<button className="button small icon-only move" disabled={!isEnabled} onClick={onClick}>
<button
className="button small icon-only move"
disabled={!isEnabled}
title={title}
onClick={onClick}
>
<FontAwesomeIcon icon={icon} />
</button>
);
@ -13,6 +18,7 @@ function MoveButton({ isEnabled, icon, onClick }) {
MoveButton.propTypes = {
isEnabled: PropTypes.bool,
icon: PropTypes.string,
title: PropTypes.string,
onClick: PropTypes.func
};

View file

@ -78,6 +78,7 @@ const TypeDeChamp = sortableElement(
<MoveButton
isEnabled={!isFirstItem}
icon="arrow-up"
title="Déplacer le champ vers le haut"
onClick={() =>
dispatch({
type: 'moveTypeDeChampUp',
@ -88,6 +89,7 @@ const TypeDeChamp = sortableElement(
<MoveButton
isEnabled={!isLastItem}
icon="arrow-down"
title="Déplacer le champ vers le bas"
onClick={() =>
dispatch({
type: 'moveTypeDeChampDown',
@ -162,8 +164,10 @@ TypeDeChamp.propTypes = {
};
const DragHandle = sortableHandle(() => (
<div className="handle small icon-only icon move-handle">
</div>
<div
className="handle small icon-only icon move-handle"
title="Déplacer le champ vers le haut ou vers le bas"
/>
));
function createUpdateHandler(dispatch, typeDeChamp, field, index, prefix) {