-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] Attachments and OEmbed margins (#25713)
<!-- This is a pull request template, you do not need to uncomment or remove the comments, they won't show up in the PR text. --> <!-- Your Pull Request name should start with one of the following tags [NEW] For new features [IMPROVE] For an improvement (performance or little improvements) in existing features [FIX] For bug fixes that affect the end-user [BREAK] For pull requests including breaking changes Chore: For small tasks Doc: For documentation --> <!-- Checklist!!! If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code. - I have read the Contributing Guide - https://github.com/RocketChat/Rocket.Chat/blob/develop/.github/CONTRIBUTING.md#contributing-to-rocketchat doc - I have signed the CLA - https://cla-assistant.io/RocketChat/Rocket.Chat - Lint and unit tests pass locally with my changes - I have added tests that prove my fix is effective or that my feature works (if applicable) - I have added necessary documentation (if applicable) - Any dependent changes have been merged and published in downstream modules --> ## Proposed changes (including videos or screenshots) <!-- CHANGELOG --> <!-- Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue below. This description will appear in the release notes if we accept the contribution. --> <!-- END CHANGELOG --> ## Issue(s) <!-- Link the issues being closed by or related to this PR. For example, you can use #594 if this PR closes issue number 594 --> ## Steps to test or reproduce <!-- Mention how you would reproduce the bug if not mentioned on the issue page already. Also mention which screens are going to have the changes if applicable --> ## Further comments <!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
- Loading branch information
1 parent
2a40792
commit 554091c
Showing
35 changed files
with
208 additions
and
214 deletions.
There are no files selected for viewing
6 changes: 0 additions & 6 deletions
6
apps/meteor/client/components/message/Attachments/Attachment/Action.tsx
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
apps/meteor/client/components/message/Attachments/Attachment/AttachmentAction.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 { ActionButton } from '@rocket.chat/fuselage'; | ||
import React, { ComponentProps, FC } from 'react'; | ||
|
||
const AttachmentAction: FC<ComponentProps<typeof ActionButton> & { icon: string }> = (props) => ( | ||
<ActionButton mi='x2' mini ghost {...props} /> | ||
); | ||
|
||
export default AttachmentAction; |
4 changes: 2 additions & 2 deletions
4
...message/Attachments/Attachment/Author.tsx → ...tachments/Attachment/AttachmentAuthor.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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import React, { ComponentProps, FC } from 'react'; | ||
|
||
const Author: FC<ComponentProps<typeof Box>> = (props) => ( | ||
const AttachmentAuthor: FC<ComponentProps<typeof Box>> = (props) => ( | ||
<Box display='flex' flexDirection='row' alignItems='center' mbe='x4' {...props} /> | ||
); | ||
|
||
export default Author; | ||
export default AttachmentAuthor; |
7 changes: 7 additions & 0 deletions
7
apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorAvatar.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,7 @@ | ||
import React, { ReactElement } from 'react'; | ||
|
||
import BaseAvatar from '../../../avatar/BaseAvatar'; | ||
|
||
const AttachmentAuthorAvatar = ({ url }: { url: string }): ReactElement => <BaseAvatar url={url} size='x24' />; | ||
|
||
export default AttachmentAuthorAvatar; |
6 changes: 6 additions & 0 deletions
6
apps/meteor/client/components/message/Attachments/Attachment/AttachmentAuthorName.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,6 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import React, { ComponentProps, FC } from 'react'; | ||
|
||
const AttachmentAuthorName: FC<ComponentProps<typeof Box>> = (props) => <Box withTruncatedText fontScale='p2m' mi='x8' {...props} />; | ||
|
||
export default AttachmentAuthorName; |
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
6 changes: 3 additions & 3 deletions
6
...ssage/Attachments/Attachment/Collapse.tsx → ...chments/Attachment/AttachmentCollapse.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { useTranslation } from '@rocket.chat/ui-contexts'; | ||
import React, { ComponentProps, FC } from 'react'; | ||
|
||
import Action from './Action'; | ||
import Action from './AttachmentAction'; | ||
|
||
const Collapse: FC<Omit<ComponentProps<typeof Action>, 'icon'> & { collapsed?: boolean }> = ({ collapsed = false, ...props }) => { | ||
const AttachmentCollapse: FC<Omit<ComponentProps<typeof Action>, 'icon'> & { collapsed?: boolean }> = ({ collapsed = false, ...props }) => { | ||
const t = useTranslation(); | ||
return <Action title={collapsed ? t('Uncollapse') : t('Collapse')} icon={!collapsed ? 'chevron-down' : 'chevron-left'} {...props} />; | ||
}; | ||
|
||
export default Collapse; | ||
export default AttachmentCollapse; |
6 changes: 6 additions & 0 deletions
6
apps/meteor/client/components/message/Attachments/Attachment/AttachmentContent.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,6 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import React, { ComponentProps, FC } from 'react'; | ||
|
||
const AttachmentContent: FC<ComponentProps<typeof Box>> = ({ ...props }) => <Box rcx-attachment__content width='full' mb='x4' {...props} />; | ||
|
||
export default AttachmentContent; |
8 changes: 8 additions & 0 deletions
8
apps/meteor/client/components/message/Attachments/Attachment/AttachmentDescription.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 React, { ComponentProps, ReactElement } from 'react'; | ||
|
||
const AttachmentDescription = ({ ...props }: ComponentProps<typeof Box>): ReactElement => ( | ||
<Box rcx-attachment__description mbe='x4' {...props} /> | ||
); | ||
|
||
export default AttachmentDescription; |
4 changes: 2 additions & 2 deletions
4
...essage/Attachments/Attachment/Details.tsx → ...achments/Attachment/AttachmentDetails.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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import React, { FC, ComponentProps } from 'react'; | ||
|
||
const Details: FC<ComponentProps<typeof Box>> = ({ ...props }) => ( | ||
const AttachmentDetails: FC<ComponentProps<typeof Box>> = ({ ...props }) => ( | ||
<Box rcx-attachment__details fontScale='p2' color='info' bg='neutral-100' pi='x16' pb='x16' {...props} /> | ||
); | ||
|
||
export default Details; | ||
export default AttachmentDetails; |
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
6 changes: 6 additions & 0 deletions
6
apps/meteor/client/components/message/Attachments/Attachment/AttachmentInner.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,6 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import React, { ComponentProps, FC } from 'react'; | ||
|
||
const AttachmentInner: FC<ComponentProps<typeof Box>> = ({ ...props }) => <Box {...props} />; | ||
|
||
export default AttachmentInner; |
4 changes: 2 additions & 2 deletions
4
...ts/message/Attachments/Attachment/Row.tsx → .../Attachments/Attachment/AttachmentRow.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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import React, { FC, ComponentProps } from 'react'; | ||
|
||
const Row: FC<ComponentProps<typeof Box>> = (props) => ( | ||
const AttachmentRow: FC<ComponentProps<typeof Box>> = (props) => ( | ||
<Box mi='neg-x2' mbe='x2' rcx-message-attachment display='flex' alignItems='center' {...props} /> | ||
); | ||
|
||
export default Row; | ||
export default AttachmentRow; |
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
6 changes: 6 additions & 0 deletions
6
apps/meteor/client/components/message/Attachments/Attachment/AttachmentText.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,6 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import React, { ComponentProps, FC } from 'react'; | ||
|
||
const AttachmentText: FC<ComponentProps<typeof Box>> = (props) => <Box mbe='x4' mi='x2' fontScale='p2' color='default' {...props}></Box>; | ||
|
||
export default AttachmentText; |
4 changes: 2 additions & 2 deletions
4
.../message/Attachments/Attachment/Thumb.tsx → ...ttachments/Attachment/AttachmentThumb.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Box, Avatar } from '@rocket.chat/fuselage'; | ||
import React, { FC, memo } from 'react'; | ||
|
||
const Thumb: FC<{ url: string }> = ({ url }) => ( | ||
const AttachmentThumb: FC<{ url: string }> = ({ url }) => ( | ||
<Box mis='x8'> | ||
<Avatar {...({ url, size: 'x48' } as any)} /> | ||
</Box> | ||
); | ||
|
||
export default memo(Thumb); | ||
export default memo(AttachmentThumb); |
8 changes: 8 additions & 0 deletions
8
apps/meteor/client/components/message/Attachments/Attachment/AttachmentTitle.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 React, { ComponentProps, FC } from 'react'; | ||
|
||
const AttachmentTitle: FC<ComponentProps<typeof Box>> = (props) => ( | ||
<Box withTruncatedText mi='x2' fontScale='c1' color='hint' {...props}></Box> | ||
); | ||
|
||
export default AttachmentTitle; |
6 changes: 3 additions & 3 deletions
6
...sage/Attachments/Attachment/TitleLink.tsx → ...hments/Attachment/AttachmentTitleLink.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import React, { FC } from 'react'; | ||
|
||
import Title from './Title'; | ||
import Title from './AttachmentTitle'; | ||
|
||
const TitleLink: FC<{ link: string; title?: string | undefined }> = ({ link, title }) => ( | ||
const AttachmentTitleLink: FC<{ link: string; title?: string | undefined }> = ({ link, title }) => ( | ||
<Title is='a' href={`${link}?download`} color={undefined} target='_blank' download={title} rel='noopener noreferrer'> | ||
{title} | ||
</Title> | ||
); | ||
|
||
export default TitleLink; | ||
export default AttachmentTitleLink; |
7 changes: 0 additions & 7 deletions
7
apps/meteor/client/components/message/Attachments/Attachment/AuthorAvatar.tsx
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
apps/meteor/client/components/message/Attachments/Attachment/AuthorName.tsx
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
apps/meteor/client/components/message/Attachments/Attachment/Content.tsx
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
apps/meteor/client/components/message/Attachments/Attachment/Inner.tsx
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
apps/meteor/client/components/message/Attachments/Attachment/Text.tsx
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
apps/meteor/client/components/message/Attachments/Attachment/Title.tsx
This file was deleted.
Oops, something went wrong.
35 changes: 1 addition & 34 deletions
35
apps/meteor/client/components/message/Attachments/Attachment/index.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 |
---|---|---|
@@ -1,36 +1,3 @@ | ||
import Image from '../components/Image'; | ||
import Attachment from './Attachment'; | ||
import Author from './Author'; | ||
import AuthorAvatar from './AuthorAvatar'; | ||
import AuthorName from './AuthorName'; | ||
import Block from './Block'; | ||
import Collapse from './Collapse'; | ||
import Content from './Content'; | ||
import Details from './Details'; | ||
import Download from './Download'; | ||
import Inner from './Inner'; | ||
import Row from './Row'; | ||
import Size from './Size'; | ||
import Text from './Text'; | ||
import Thumb from './Thumb'; | ||
import Title from './Title'; | ||
import TitleLink from './TitleLink'; | ||
|
||
export default Object.assign(Attachment, { | ||
Image, | ||
Row, | ||
Title, | ||
Text, | ||
TitleLink, | ||
Size, | ||
Thumb, | ||
Collapse, | ||
Download, | ||
Content, | ||
Details, | ||
Inner, | ||
Block, | ||
Author, | ||
AuthorAvatar, | ||
AuthorName, | ||
}); | ||
export default Attachment; |
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
Oops, something went wrong.