2022-02-01 14:16:21 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
import FxButton from './FxButton';
|
2022-09-14 08:04:49 +00:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2022-02-01 14:16:21 +00:00
|
|
|
|
|
|
|
|
export const AlignButtons = ({ value, onChange, forceCodeBox, meta }) => {
|
|
|
|
|
function handleOptionChanged(event) {
|
|
|
|
|
onChange(event.currentTarget.value);
|
|
|
|
|
}
|
2022-09-14 08:04:49 +00:00
|
|
|
const { t } = useTranslation();
|
2022-02-01 14:16:21 +00:00
|
|
|
|
|
|
|
|
return (
|
2022-06-20 03:54:53 +00:00
|
|
|
<div className="row fx-container">
|
2022-02-07 10:38:42 +00:00
|
|
|
<div className="col">
|
2022-02-01 14:16:21 +00:00
|
|
|
<div className={`mb-3 field ${meta?.options?.className}`}>
|
|
|
|
|
<div style={{ display: 'flex', gap: 10 }}>
|
|
|
|
|
<label className="radio-img">
|
|
|
|
|
<input
|
|
|
|
|
type="radio"
|
|
|
|
|
name="alignment"
|
|
|
|
|
value="left"
|
|
|
|
|
onChange={handleOptionChanged}
|
|
|
|
|
checked={value === 'left'}
|
|
|
|
|
/>
|
|
|
|
|
<div className="action-icon">
|
|
|
|
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
|
|
|
<path
|
|
|
|
|
d="M2 4H14M2 8H8.66667M2 12H12"
|
|
|
|
|
stroke={value == 'left' ? '#fff' : '#8092AC'}
|
|
|
|
|
strokeWidth="1.5"
|
|
|
|
|
strokeLinecap="round"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
2022-09-14 08:04:49 +00:00
|
|
|
<span className="tooltiptext">{t('globals.left', 'Left')}</span>
|
2022-02-01 14:16:21 +00:00
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
<label className="radio-img">
|
|
|
|
|
<input
|
|
|
|
|
type="radio"
|
|
|
|
|
name="alignment"
|
|
|
|
|
value="center"
|
|
|
|
|
onChange={handleOptionChanged}
|
|
|
|
|
checked={value === 'center'}
|
|
|
|
|
/>
|
|
|
|
|
<div className="action-icon">
|
|
|
|
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
|
|
|
<path
|
|
|
|
|
d="M2 4H14M4.66667 8H11.3333M3.33333 12H12.6667"
|
|
|
|
|
stroke={value == 'center' ? '#fff' : '#8092AC'}
|
|
|
|
|
strokeWidth="1.5"
|
|
|
|
|
strokeLinecap="round"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
2022-09-14 08:04:49 +00:00
|
|
|
<span className="tooltiptext">{t('globals.center', 'Center')}</span>
|
2022-02-01 14:16:21 +00:00
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
<label className="radio-img">
|
|
|
|
|
<input
|
|
|
|
|
type="radio"
|
|
|
|
|
name="alignment"
|
|
|
|
|
value="right"
|
|
|
|
|
onChange={handleOptionChanged}
|
|
|
|
|
checked={value === 'right'}
|
|
|
|
|
/>
|
|
|
|
|
<div className="action-icon">
|
|
|
|
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
|
|
|
<path
|
|
|
|
|
d="M2 4H14M7.33333 8H14M4 12H14"
|
|
|
|
|
stroke={value == 'right' ? '#fff' : '#8092AC'}
|
|
|
|
|
strokeWidth="1.5"
|
|
|
|
|
strokeLinecap="round"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
2022-09-14 08:04:49 +00:00
|
|
|
<span className="tooltiptext">{t('globals.right', 'Right')}</span>
|
2022-02-01 14:16:21 +00:00
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
<label className="radio-img">
|
|
|
|
|
<input
|
|
|
|
|
type="radio"
|
|
|
|
|
name="alignment"
|
|
|
|
|
value="justify"
|
|
|
|
|
onChange={handleOptionChanged}
|
|
|
|
|
checked={value === 'justify'}
|
|
|
|
|
/>
|
|
|
|
|
<div className="action-icon">
|
|
|
|
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
|
|
|
<path
|
|
|
|
|
d="M2 8H14M2 12H14M2 4H8H14H2Z"
|
|
|
|
|
stroke={value == 'justify' ? '#fff' : '#8092AC'}
|
|
|
|
|
strokeWidth="1.5"
|
|
|
|
|
strokeLinecap="round"
|
|
|
|
|
strokeLinejoin="round"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
2022-09-14 08:04:49 +00:00
|
|
|
<span className="tooltiptext">{t('globals.justified', 'Justified')}</span>
|
2022-02-01 14:16:21 +00:00
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-06-20 03:54:53 +00:00
|
|
|
<div className="col-auto pt-0 style-fx fx-common">
|
2022-02-01 14:16:21 +00:00
|
|
|
<FxButton active={false} onPress={forceCodeBox} />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|