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 PropTypes from 'prop-types';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
function MoveButton({ isEnabled, icon, onClick }) { function MoveButton({ isEnabled, icon, title, onClick }) {
return ( 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} /> <FontAwesomeIcon icon={icon} />
</button> </button>
); );
@ -13,6 +18,7 @@ function MoveButton({ isEnabled, icon, onClick }) {
MoveButton.propTypes = { MoveButton.propTypes = {
isEnabled: PropTypes.bool, isEnabled: PropTypes.bool,
icon: PropTypes.string, icon: PropTypes.string,
title: PropTypes.string,
onClick: PropTypes.func onClick: PropTypes.func
}; };

View file

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