Skip to content

Commit

Permalink
refactor: adjust styling of conversion field in reaction scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
adambasha0 committed Nov 6, 2024
1 parent e8622cc commit a11b53b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,24 +513,6 @@ export default class ReactionDetails extends Component {
render() {
const { reaction, visible, activeTab } = this.state;
this.updateReactionVesselSize(reaction);
const schemeTitle = reaction && activeTab === 'scheme' ? (
<div style={{ display: 'flex' }}>
<div style={{ paddingRight: '2px' }}>
<ToggleButton
isToggledInitial={reaction.gaseous}
onToggle={this.handleGaseousChange}
onLabel="Gas Scheme"
offLabel="Default Scheme"
onColor="#afcfee"
offColor="#d3d3d3"
tooltipOn="Click to enable Default mode"
tooltipOff="Click to enable Gas mode"
fontSize="14px"
fontWeight="normal"
/>
</div>
</div>
) : 'Scheme';
const tabContentsMap = {
scheme: (
<Tab eventKey="scheme" title="Scheme" key={`scheme_${reaction.id}`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ class Material extends Component {
unit="%"
disabled={!permitOn(reaction)}
onChange={(e) => this.handleConversionRateChange(e)}
size="sm"
/>
</div>
);
Expand All @@ -287,7 +288,7 @@ class Material extends Component {
name="yield"
type="text"
bsClass="bs-form--compact form-control"
bsSize="small"
size="sm"
value={this.calculateYield(material, reaction) || 'n.d.'}
disabled
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ function GeneralMaterialGroup({
offColor="transparent"
tooltipOn={conversionText}
tooltipOff={yieldText}
fontSize="14px"
fontWeight="bold"
fontType="fw-bold"
fontColor="text-dark"
/>
</div>
);
Expand Down
14 changes: 7 additions & 7 deletions app/packs/src/components/common/ToggleButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from 'prop-types';

export default function ToggleButton({
isToggledInitial, onToggle, onChange, onLabel, offLabel,
onColor, offColor, tooltipOn, tooltipOff, fontSize, fontWeight
onColor, offColor, tooltipOn, tooltipOff, fontType, fontColor
}) {
const [isToggled, setIsToggled] = useState(isToggledInitial);

Expand All @@ -28,9 +28,9 @@ export default function ToggleButton({
className={`toggle-button ${isToggled ? 'on' : 'off'}`}
size="xs"
onClick={handleChange}
style={{ backgroundColor: buttonColor, minWidth: '50px', border: 'none' }}
style={{ backgroundColor: buttonColor, border: 'none', padding: '0px 0px 0px 0px' }}
>
<span className="fs-6">
<span className={`fs-6 ${fontType} ${fontColor}`}>
{isToggled ? onLabel : offLabel}
</span>
</Button>
Expand All @@ -48,8 +48,8 @@ ToggleButton.propTypes = {
offColor: PropTypes.string,
tooltipOn: PropTypes.string,
tooltipOff: PropTypes.string,
fontWeight: PropTypes.string,
fontSize: PropTypes.string,
fontType: PropTypes.string,
fontColor: PropTypes.string,
};

ToggleButton.defaultProps = {
Expand All @@ -61,6 +61,6 @@ ToggleButton.defaultProps = {
offColor: '#d3d3d3',
tooltipOn: 'Click to switch off',
tooltipOff: 'Click to switch on',
fontWeight: 'normal',
fontSize: '1em',
fontType: 'normal',
fontColor: '1em',
};

0 comments on commit a11b53b

Please sign in to comment.