-
Notifications
You must be signed in to change notification settings - Fork 29
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
Make ribbon block error indicators more obvious #5145
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { Revision } from 'dvc/src/plots/webview/contract' | ||
import cx from 'classnames' | ||
import React from 'react' | ||
import styles from './styles.module.scss' | ||
import { RibbonBlockIcon } from './RibbonBlockIcon' | ||
import { RibbonBlockTooltip } from './RibbonBlockTooltip' | ||
import { RevisionIcon } from './RevisionIcon' | ||
import { Icon } from '../../../shared/components/Icon' | ||
import Tooltip from '../../../shared/components/tooltip/Tooltip' | ||
import { CopyButton } from '../../../shared/components/copyButton/CopyButton' | ||
import { Close, Info } from '../../../shared/components/icons' | ||
import { Close } from '../../../shared/components/icons' | ||
|
||
interface RibbonBlockProps { | ||
revision: Revision | ||
|
@@ -27,19 +29,22 @@ export const RibbonBlock: React.FC<RibbonBlockProps> = ({ | |
id, | ||
label | ||
} = revision | ||
const hasError = fetched && !!errors | ||
|
||
const mainContent = ( | ||
<li | ||
className={styles.block} | ||
style={{ borderColor: displayColor }} | ||
data-testid={`ribbon-${id}`} | ||
> | ||
<Info width={14} height={14} className={styles.infoIcon} /> | ||
<RibbonBlockIcon hasError={hasError} /> | ||
<div className={styles.label}> | ||
{description ? ( | ||
<> | ||
<div className={styles.subtitle}>{label}</div> | ||
<div className={styles.title}> | ||
<div | ||
className={cx(styles.title, hasError && styles.errorIndicator)} | ||
> | ||
{description} | ||
<CopyButton | ||
value={description.replace(/[[\]]/g, '')} | ||
|
@@ -48,14 +53,14 @@ export const RibbonBlock: React.FC<RibbonBlockProps> = ({ | |
</div> | ||
</> | ||
) : ( | ||
<div className={styles.title}> | ||
<div className={cx(styles.title, hasError && styles.errorIndicator)}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{label} | ||
<CopyButton value={label} className={styles.copyButton} /> | ||
</div> | ||
)} | ||
</div> | ||
<div className={styles.iconPlaceholder}> | ||
<RevisionIcon errors={errors} fetched={fetched} /> | ||
<RevisionIcon fetched={fetched} /> | ||
</div> | ||
<Tooltip content="Clear" placement="bottom" delay={500}> | ||
<button className={styles.clearButton} onClick={onClear}> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react' | ||
import cx from 'classnames' | ||
import styles from './styles.module.scss' | ||
import { Error, Info } from '../../../shared/components/icons' | ||
|
||
export const RibbonBlockIcon: React.FC<{ | ||
hasError: boolean | ||
}> = ({ hasError }) => | ||
hasError ? ( | ||
<Error | ||
width={14} | ||
height={14} | ||
className={cx(styles.blockIcon, styles.error)} | ||
aria-label="Error Icon" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically, you can label svgs but we don't really do this in the extension. I added labels for testing but there might be a better way of handling this. |
||
/> | ||
) : ( | ||
<Info | ||
width={14} | ||
height={14} | ||
className={styles.blockIcon} | ||
aria-label="Info Icon" | ||
/> | ||
) |
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.
Next steps after this would be updating section title tooltips to include an error. Full design ideas list is in #5087 (comment)