-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Update
UploadProgressIndicator
styles (#35008)
- Loading branch information
1 parent
c8c8eaa
commit 0858ce5
Showing
9 changed files
with
105 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
apps/meteor/client/views/room/body/ErroredUploadProgressIndicator.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
apps/meteor/client/views/room/body/UploadProgress/UploadProgressContainer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import type { ComponentProps } from 'react'; | ||
|
||
const UploadProgressContainer = (props: ComponentProps<typeof Box>) => { | ||
return <Box position='relative' display='flex' flexDirection='column' overflow='hidden' mi={24} mbs={8} zIndex={2} {...props} />; | ||
}; | ||
|
||
export default UploadProgressContainer; |
65 changes: 65 additions & 0 deletions
65
apps/meteor/client/views/room/body/UploadProgress/UploadProgressIndicator.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { css } from '@rocket.chat/css-in-js'; | ||
import { Box, Button, Palette } from '@rocket.chat/fuselage'; | ||
import type { ReactElement } from 'react'; | ||
import { useCallback } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import type { Upload } from '../../../../lib/chats/Upload'; | ||
|
||
type UploadProgressIndicatorProps = { | ||
id: Upload['id']; | ||
name: string; | ||
percentage: number; | ||
error?: string; | ||
onClose?: (id: Upload['id']) => void; | ||
}; | ||
|
||
const UploadProgressIndicator = ({ id, name, percentage, error, onClose }: UploadProgressIndicatorProps): ReactElement | null => { | ||
const { t } = useTranslation(); | ||
|
||
const customClass = css` | ||
&::after { | ||
content: ''; | ||
position: absolute; | ||
z-index: 1; | ||
left: 0; | ||
width: ${percentage}%; | ||
height: 100%; | ||
transition: width, 1s, ease-out; | ||
background-color: ${Palette.surface['surface-neutral']}; | ||
} | ||
`; | ||
|
||
const handleCloseClick = useCallback(() => { | ||
onClose?.(id); | ||
}, [id, onClose]); | ||
|
||
return ( | ||
<Box | ||
pb={4} | ||
pi={8} | ||
mbe={4} | ||
borderRadius={4} | ||
borderWidth={1} | ||
border='1px solid' | ||
color={error ? 'danger' : 'info'} | ||
overflow='hidden' | ||
position='relative' | ||
display='flex' | ||
elevation='1' | ||
alignItems='center' | ||
justifyContent='space-between' | ||
bg='surface-tint' | ||
className={customClass} | ||
> | ||
<Box withTruncatedText zIndex={2} borderRadius={4}> | ||
[{percentage}%] {name} | ||
</Box> | ||
<Button zIndex={3} small onClick={handleCloseClick}> | ||
{t('Cancel')} | ||
</Button> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default UploadProgressIndicator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as UploadProgressIndicator } from './UploadProgressIndicator'; | ||
export { default as UploadProgressContainer } from './UploadProgressContainer'; |
40 changes: 0 additions & 40 deletions
40
apps/meteor/client/views/room/body/UploadProgressIndicator.tsx
This file was deleted.
Oops, something went wrong.