-
Notifications
You must be signed in to change notification settings - Fork 44
cleanup styles of queue components Part 2 #1786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9b0f8f8
to
c275a44
Compare
const padding = i > 0 ? '1em' : '0em'; | ||
const padding = i > 0 ? '1.5em' : '0.5em'; | ||
return ( | ||
<div key={`wedge-${i}`}> | ||
<div | ||
className={styles.dataPath} | ||
style={{ | ||
borderLeft: '1px solid #DDD', | ||
borderRight: '1px solid #DDD', | ||
paddingTop: padding, | ||
}} | ||
> | ||
<div | ||
style={{ | ||
borderTop: '1px solid #DDD', | ||
padding: '0.5em', | ||
display: 'flex', | ||
justifyContent: 'space-around', | ||
alignItems: 'center', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and also in TaskItem
I merged the styles and created 1 single div for both. That is also the reason why I increased the conditional padding in both cases by 0.5em
<i | ||
style={{ marginLeft: 0 }} | ||
className="fa fa-copy" | ||
aria-hidden="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of this marginLeft
style is a consequence of removing the applied style on all font-awesome icons in #1775. Hence, setting marginLeft
to 0 is not necessary anymore, as it is the default.
const delTaskCSS = { | ||
display: 'flex', | ||
marginLeft: 'auto', | ||
alignItems: 'center', | ||
paddingLeft: '10px', | ||
paddingRight: '10px', | ||
color: '#d9534f', | ||
cursor: 'pointer', | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this to module
let pbarBsStyle = 'info'; | ||
|
||
switch (state) { | ||
case TASK_RUNNING: { | ||
taskCSS += ` ${styles.taskRunning}`; | ||
pbarBsStyle = 'info'; | ||
break; | ||
} | ||
case TASK_COLLECTED: { | ||
pbarBsStyle = 'success'; | ||
if ( | ||
specialTaskCSS === 'Characterisation' && | ||
diffractionPlanLength === undefined | ||
) { | ||
taskCSS += ` ${styles.taskWarning}`; | ||
break; | ||
} | ||
taskCSS += ` ${styles.taskSuccess}`; | ||
break; | ||
} | ||
case TASK_COLLECT_FAILED: { | ||
taskCSS += ` ${styles.taskError}`; | ||
pbarBsStyle = 'danger'; | ||
break; | ||
} | ||
// No default | ||
} | ||
taskCSS += ` ${ | ||
warningTaskCSS ? styles.taskWarning : stateBasedStyles[state] || '' | ||
}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments on this:
- instead of passing
specialTaskCSS
anddiffractionPLanLength
, now only one prop (warningTaskCSS
) is passed if the warning style should be applied. OnlyCharacterisationTaskItem
uses this prop. - replaced the switch statement with a look-up table for styles.
- removed
pbarStyle
because theProgressBar
is only rendered ifstate
equalsTASK_RUNNING
hence the conditional setting was unnecessary
<b> | ||
<span className="node-name" style={{ display: 'flex' }}> | ||
{pointIDString} {dataLabel} | ||
{state === TASK_RUNNING && ( | ||
<span | ||
style={{ | ||
width: '150px', | ||
right: '60px', | ||
position: 'absolute', | ||
}} | ||
> | ||
<ProgressBar | ||
variant={pbarBsStyle} | ||
striped | ||
style={{ marginBottom: 0, height: '18px' }} | ||
min={0} | ||
max={1} | ||
animated={progress < 1} | ||
label={`${(progress * 100).toPrecision(3)} %`} | ||
now={progress} | ||
/> | ||
</span> | ||
)} | ||
</span> | ||
</b> | ||
<span className={styles.nodeName} style={{ fontWeight: 'bold' }}> | ||
{pointIDString} {dataLabel} | ||
</span> | ||
{state === TASK_RUNNING && ( | ||
<ProgressBar | ||
variant="info" | ||
striped | ||
className={styles.progressBar} | ||
min={0} | ||
max={1} | ||
animated={progress < 1} | ||
label={`${(progress * 100).toPrecision(3)} %`} | ||
now={progress} | ||
/> | ||
)} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced span
and b
tags here with proper styling
c275a44
to
db01813
Compare
db01813
to
e82858f
Compare
This PR is a follow-up to #1775. It includes the following changes concerning the CSS styles of the queue components:
TaskItemContainer