-
Notifications
You must be signed in to change notification settings - Fork 314
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
fix(content-uploader): resolve ItemAction issues #3631
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from 'react'; | ||
import { useIntl } from 'react-intl'; | ||
import { LoadingIndicator } from '@box/blueprint-web'; | ||
import { IconCtaIconHover, Size5 } from '@box/blueprint-web-assets/tokens/tokens'; | ||
import { XMark } from '@box/blueprint-web-assets/icons/Fill'; | ||
import messages from '../common/messages'; | ||
|
||
const IconInProgress = () => { | ||
const { formatMessage } = useIntl(); | ||
|
||
return ( | ||
<div className="bcu-IconInProgress"> | ||
<XMark color={IconCtaIconHover} height={Size5} width={Size5} /> | ||
<LoadingIndicator aria-label={formatMessage(messages.loading)} className="bcu-IconInProgress-loading" /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default IconInProgress; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
.bcu-item-progress { | ||
.bcu-ItemProgress { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.bcu-progress-label { | ||
.bcu-ItemProgress-label { | ||
min-width: 35px; // 100% takes up 34.27px | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as React from 'react'; | ||
import ProgressBar from './ProgressBar'; | ||
import './ItemProgress.scss'; | ||
|
||
export interface ItemProgressProps { | ||
progress: number; | ||
} | ||
|
||
const ItemProgress = ({ progress }: ItemProgressProps) => ( | ||
<div className="bcu-ItemProgress"> | ||
<ProgressBar percent={progress} /> | ||
<div className="bcu-ItemProgress-label">{progress}%</div> | ||
</div> | ||
); | ||
|
||
export default ItemProgress; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import * as React from 'react'; | ||
import { useIntl } from 'react-intl'; | ||
import { IconButton, Tooltip } from '@box/blueprint-web'; | ||
import { GrayBlack, Size5 } from '@box/blueprint-web-assets/tokens/tokens'; | ||
import { XMark } from '@box/blueprint-web-assets/icons/Fill'; | ||
|
||
import type { UploadItem, UploadStatus } from '../../common/types/upload'; | ||
|
@@ -16,6 +15,8 @@ export interface ItemRemoveProps { | |
} | ||
|
||
const ItemRemove = ({ onClick, status }: ItemRemoveProps) => { | ||
const { formatMessage } = useIntl(); | ||
|
||
const resin: Record<string, string> = {}; | ||
let target = null; | ||
|
||
|
@@ -29,20 +30,13 @@ const ItemRemove = ({ onClick, status }: ItemRemoveProps) => { | |
resin['data-resin-target'] = target; | ||
} | ||
|
||
const intl = useIntl(); | ||
const isDisabled = status === STATUS_STAGED; | ||
const tooltipText = intl.formatMessage(messages.remove); | ||
const tooltipText = formatMessage(messages.remove); | ||
|
||
return ( | ||
<div className="bcu-item-action"> | ||
<Tooltip content={tooltipText} variant="standard"> | ||
<IconButton | ||
aria-label={tooltipText} | ||
disabled={isDisabled} | ||
onClick={onClick} | ||
icon={() => <XMark color={GrayBlack} height={Size5} width={Size5} />} | ||
{...resin} | ||
/> | ||
<Tooltip content={tooltipText}> | ||
<IconButton aria-label={tooltipText} disabled={isDisabled} onClick={onClick} icon={XMark} {...resin} /> | ||
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. Just want to make sure that it is intended to use the default icon styles here while overriding the prop like 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. good question. yes this is intended since in the case of |
||
</Tooltip> | ||
</div> | ||
); | ||
|
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.
I saw this line is duplicate with the STATUS_STAGED case above. Could we deduplicate it by having it written separately since the LoadingIndicator would kind be fixed.
const LoadingIndicatorIcon = () => <LoadingIndicator aria-label={formatMessage(messages.loading)} className="bcu-ItemAction-loading" />
And replaced the current line withIcon = LoadingIndicatorIcon;