-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* URL preview - WIP * fix url preview regex * update url match regex * add url preview components * add scroll btn url preview holder * add message body component * add url preview toggle in settings * update url regex * improve url regex * increase thumbnail size in url preview * hide url preview in encrypted rooms * add encrypted room url preview toggle
- Loading branch information
Showing
11 changed files
with
444 additions
and
42 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
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,45 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
import { DefaultReset, color, config, toRem } from 'folds'; | ||
|
||
export const UrlPreview = style([ | ||
DefaultReset, | ||
{ | ||
width: toRem(400), | ||
minHeight: toRem(102), | ||
backgroundColor: color.SurfaceVariant.Container, | ||
color: color.SurfaceVariant.OnContainer, | ||
border: `${config.borderWidth.B300} solid ${color.SurfaceVariant.ContainerLine}`, | ||
borderRadius: config.radii.R300, | ||
overflow: 'hidden', | ||
}, | ||
]); | ||
|
||
export const UrlPreviewImg = style([ | ||
DefaultReset, | ||
{ | ||
width: toRem(100), | ||
height: toRem(100), | ||
objectFit: 'cover', | ||
objectPosition: 'left', | ||
backgroundPosition: 'start', | ||
flexShrink: 0, | ||
overflow: 'hidden', | ||
}, | ||
]); | ||
|
||
export const UrlPreviewContent = style([ | ||
DefaultReset, | ||
{ | ||
padding: config.space.S200, | ||
}, | ||
]); | ||
|
||
export const UrlPreviewDescription = style([ | ||
DefaultReset, | ||
{ | ||
display: '-webkit-box', | ||
WebkitLineClamp: 2, | ||
WebkitBoxOrient: 'vertical', | ||
overflow: 'hidden', | ||
}, | ||
]); |
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,27 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import { Box, as } from 'folds'; | ||
import * as css from './UrlPreview.css'; | ||
|
||
export const UrlPreview = as<'div'>(({ className, ...props }, ref) => ( | ||
<Box shrink="No" className={classNames(css.UrlPreview, className)} {...props} ref={ref} /> | ||
)); | ||
|
||
export const UrlPreviewImg = as<'img'>(({ className, alt, ...props }, ref) => ( | ||
<img className={classNames(css.UrlPreviewImg, className)} alt={alt} {...props} ref={ref} /> | ||
)); | ||
|
||
export const UrlPreviewContent = as<'div'>(({ className, ...props }, ref) => ( | ||
<Box | ||
grow="Yes" | ||
direction="Column" | ||
gap="100" | ||
className={classNames(css.UrlPreviewContent, className)} | ||
{...props} | ||
ref={ref} | ||
/> | ||
)); | ||
|
||
export const UrlPreviewDescription = as<'span'>(({ className, ...props }, ref) => ( | ||
<span className={classNames(css.UrlPreviewDescription, className)} {...props} ref={ref} /> | ||
)); |
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 @@ | ||
export * from './UrlPreview'; |
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.