forked from github/cinny
Add URL preview (#1511)
* 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
This commit is contained in:
27
src/app/components/url-preview/UrlPreview.tsx
Normal file
27
src/app/components/url-preview/UrlPreview.tsx
Normal file
@@ -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} />
|
||||
));
|
||||
Reference in New Issue
Block a user