-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added MessageGenericPreview component
added PreviewBlock fixed link visibility styling remaining
- Loading branch information
1 parent
eddc138
commit 9fe12a7
Showing
11 changed files
with
319 additions
and
12 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
28 changes: 28 additions & 0 deletions
28
packages/react/src/components/MessageGenericPreview/MessageGenericPreview.js
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,28 @@ | ||
import React from 'react'; | ||
import { css } from '@emotion/react'; | ||
import useComponentOverrides from '../../theme/useComponentOverrides'; | ||
|
||
const MessageGenericPreview = (props, className = '', style = {}) => { | ||
const { classNames, styleOverrides } = useComponentOverrides( | ||
'MessageGenericPreview' | ||
); | ||
const messageGenericPreviewStyles = css` | ||
display: flex; | ||
overflow: hidden; | ||
flex-direction: column; | ||
padding: 0.75rem; | ||
border: 1px solid #ccc; | ||
border-radius: 5px; | ||
background-color: #cbced1; | ||
`; | ||
return ( | ||
<div | ||
css={messageGenericPreviewStyles} | ||
className={`ec-message-generic-preview ${className} ${classNames}`} | ||
style={{ ...style, ...styleOverrides }} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
export default MessageGenericPreview; |
32 changes: 32 additions & 0 deletions
32
packages/react/src/components/MessageGenericPreview/MessageGenericPreviewContent.js
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,32 @@ | ||
import React from 'react'; | ||
import { css } from '@emotion/react'; | ||
import useComponentOverrides from '../../theme/useComponentOverrides'; | ||
|
||
const MessageGenericPreviewContent = ({ | ||
className = '', | ||
style = {}, | ||
thumb, | ||
...props | ||
}) => { | ||
const { classNames, styleOverrides } = useComponentOverrides( | ||
'MessageGenericPreviewContent' | ||
); | ||
|
||
const MessageGenericPreviewContentCss = css` | ||
display: flex; | ||
flex-direction: row; | ||
`; | ||
|
||
return ( | ||
<div | ||
css={MessageGenericPreviewContentCss} | ||
className={`ec-message-generic-preview__content ${className} ${classNames}`} | ||
style={{ ...style, ...styleOverrides }} | ||
> | ||
{thumb} | ||
<div className="ec-message-generic-preview__content-wrapper" {...props} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MessageGenericPreviewContent; |
34 changes: 34 additions & 0 deletions
34
packages/react/src/components/MessageGenericPreview/MessageGenericPreviewCoverImage.js
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,34 @@ | ||
import React from 'react'; | ||
import { css } from '@emotion/react'; | ||
import useComponentOverrides from '../../theme/useComponentOverrides'; | ||
|
||
const MessageGenericPreviewCoverImage = ({ | ||
className = '', | ||
style = {}, | ||
url, | ||
width, | ||
height, | ||
...props | ||
}) => { | ||
const { classNames, styleOverrides } = useComponentOverrides( | ||
'MessageGenericPreviewCoverImage' | ||
); | ||
|
||
const previewCoverImageCss = css` | ||
background-image: url(${url}); | ||
max-width: 100%; | ||
`; | ||
|
||
return ( | ||
<div | ||
css={previewCoverImageCss} | ||
className={`ec-message-generic-preview__preview ${className} ${classNames}`} | ||
style={{ ...style, ...styleOverrides }} | ||
{...props} | ||
> | ||
<div style={{ paddingTop: `${(height / width) * 100}%` }} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MessageGenericPreviewCoverImage; |
28 changes: 28 additions & 0 deletions
28
packages/react/src/components/MessageGenericPreview/MessageGenericPreviewDescription.js
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,28 @@ | ||
import React from 'react'; | ||
import useComponentOverrides from '../../theme/useComponentOverrides'; | ||
|
||
const MessageGenericPreviewDescription = ({ | ||
children, | ||
clamp = false, | ||
className = '', | ||
style = {}, | ||
...props | ||
}) => { | ||
const { classNames, styleOverrides } = useComponentOverrides( | ||
'MessageGenericPreviewDescription' | ||
); | ||
|
||
return ( | ||
<div | ||
className={`ec-message-generic-preview__description ${ | ||
clamp ? 'ec-message-generic-preview__description--clamp' : '' | ||
} ${className} ${classNames}`} | ||
style={{ ...style, ...styleOverrides }} | ||
{...props} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default MessageGenericPreviewDescription; |
25 changes: 25 additions & 0 deletions
25
packages/react/src/components/MessageGenericPreview/MessageGenericPreviewFooter.js
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,25 @@ | ||
import React from 'react'; | ||
import useComponentOverrides from '../../theme/useComponentOverrides'; | ||
|
||
const MessageGenericPreviewFooter = ({ | ||
children, | ||
className = '', | ||
style = {}, | ||
...props | ||
}) => { | ||
const { classNames, styleOverrides } = useComponentOverrides( | ||
'MessageGenericPreviewFooter' | ||
); | ||
|
||
return ( | ||
<div | ||
className={`ec-message-generic-preview__footer ${className} ${classNames}`} | ||
style={{ ...style, ...styleOverrides }} | ||
{...props} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default MessageGenericPreviewFooter; |
17 changes: 17 additions & 0 deletions
17
packages/react/src/components/MessageGenericPreview/MessageGenericPreviewThumb.js
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,17 @@ | ||
import React from 'react'; | ||
import useComponentOverrides from '../../theme/useComponentOverrides'; | ||
|
||
const MessageGenericPreviewThumb = (className = '', style = {}, ...props) => { | ||
const { classNames, styleOverrides } = useComponentOverrides( | ||
'MessageGenericPreviewThumb' | ||
); | ||
return ( | ||
<div | ||
className={`ec-message-generic-preview__thumb ${className} ${classNames}`} | ||
style={{ ...style, ...styleOverrides }} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
export default MessageGenericPreviewThumb; |
40 changes: 40 additions & 0 deletions
40
packages/react/src/components/MessageGenericPreview/MessageGenericPreviewTitle.js
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,40 @@ | ||
import React from 'react'; | ||
import useComponentOverrides from '../../theme/useComponentOverrides'; | ||
|
||
const MessageGenericPreviewTitle = ({ | ||
externalUrl, | ||
children, | ||
className = '', | ||
style = {}, | ||
...props | ||
}) => { | ||
const { classNames, styleOverrides } = useComponentOverrides( | ||
'MessageGenericPreviewTitle' | ||
); | ||
|
||
if (externalUrl) { | ||
return ( | ||
<a | ||
className={`ec-message-generic-preview__title ${className} ${classNames}`} | ||
style={{ ...style, ...styleOverrides }} | ||
href={externalUrl} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
{...props} | ||
> | ||
{children} | ||
</a> | ||
); | ||
} | ||
return ( | ||
<span | ||
className={`ec-message-generic-preview__title ${className} ${classNames}`} | ||
style={{ ...style, ...styleOverrides }} | ||
{...props} | ||
> | ||
{children} | ||
</span> | ||
); | ||
}; | ||
|
||
export default MessageGenericPreviewTitle; |
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 @@ | ||
export { default as MessageGenericPreview } from './MessageGenericPreview'; | ||
export { default as MessageGenericPreviewCoverImage } from './MessageGenericPreviewCoverImage'; | ||
export { default as MessageGenericPreviewThumb } from './MessageGenericPreviewThumb'; | ||
export { default as MessageGenericPreviewTitle } from './MessageGenericPreviewTitle'; | ||
export { default as MessageGenericPreviewContent } from './MessageGenericPreviewContent'; | ||
export { default as MessageGenericPreviewDescription } from './MessageGenericPreviewDescription'; | ||
export { default as MessageGenericPreviewFooter } from './MessageGenericPreviewFooter'; |
85 changes: 85 additions & 0 deletions
85
packages/react/src/components/uiKit/blocks/PreviewBlock.js
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