types_de_champs_editor: improve apparence of Move buttons

This commit is contained in:
Pierre de La Morinerie 2019-04-03 15:35:49 +02:00
parent 1acc4b6ed5
commit 1880e5161b
3 changed files with 22 additions and 13 deletions

View file

@ -14,8 +14,20 @@
} }
.move { .move {
height: 44px;
border-radius: 25px;
margin-right: 10px; margin-right: 10px;
margin-bottom: 5px;
&:first-of-type {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
margin-bottom: -1px;
}
&:last-of-type {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
} }
&.type-header-section { &.type-header-section {

View file

@ -2,19 +2,16 @@ 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({ isVisible, icon, onClick }) { function MoveButton({ isEnabled, icon, onClick }) {
if (isVisible) {
return ( return (
<button className="button small icon-only move" onClick={onClick}> <button className="button small icon-only move" disabled={!isEnabled} onClick={onClick}>
<FontAwesomeIcon icon={icon} /> <FontAwesomeIcon icon={icon} />
</button> </button>
); );
}
return null;
} }
MoveButton.propTypes = { MoveButton.propTypes = {
isVisible: PropTypes.bool, isEnabled: PropTypes.bool,
icon: PropTypes.string, icon: PropTypes.string,
onClick: PropTypes.func onClick: PropTypes.func
}; };

View file

@ -76,7 +76,7 @@ const TypeDeChamp = sortableElement(
> >
<div className="flex column justify-start"> <div className="flex column justify-start">
<MoveButton <MoveButton
isVisible={!isFirstItem} isEnabled={!isFirstItem}
icon="arrow-up" icon="arrow-up"
onClick={() => onClick={() =>
dispatch({ dispatch({
@ -86,7 +86,7 @@ const TypeDeChamp = sortableElement(
} }
/> />
<MoveButton <MoveButton
isVisible={!isLastItem} isEnabled={!isLastItem}
icon="arrow-down" icon="arrow-down"
onClick={() => onClick={() =>
dispatch({ dispatch({