mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 09:31:17 -08:00
57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
import { Text, as } from 'folds';
|
|
import classNames from 'classnames';
|
|
import * as css from './layout.css';
|
|
|
|
export const MessageBase = as<'div', css.MessageBaseVariants>(
|
|
(
|
|
{ className, highlight, notifyHighlight, selected, collapse, autoCollapse, space, ...props },
|
|
ref
|
|
) => (
|
|
<div
|
|
className={classNames(
|
|
css.MessageBase({ highlight, notifyHighlight, selected, collapse, autoCollapse, space }),
|
|
className
|
|
)}
|
|
{...props}
|
|
ref={ref}
|
|
/>
|
|
)
|
|
);
|
|
|
|
export const AvatarBase = as<'span'>(({ className, ...props }, ref) => (
|
|
<span className={classNames(css.AvatarBase, className)} {...props} ref={ref} />
|
|
));
|
|
|
|
export const Username = as<'span'>(({ as: AsUsername = 'span', className, ...props }, ref) => (
|
|
<AsUsername className={classNames(css.Username, className)} {...props} ref={ref} />
|
|
));
|
|
|
|
export const UsernameBold = as<'b'>(({ as: AsUsernameBold = 'b', className, ...props }, ref) => (
|
|
<AsUsernameBold className={classNames(css.UsernameBold, className)} {...props} ref={ref} />
|
|
));
|
|
|
|
export const PronounPill = as<'span'>(
|
|
({ as: AsPronounPill = 'span', className, ...props }, ref) => (
|
|
<AsPronounPill className={classNames(css.PronounPill, className)} {...props} ref={ref} />
|
|
)
|
|
);
|
|
|
|
export const MessageTextBody = as<'div', css.MessageTextBodyVariants & { notice?: boolean }>(
|
|
(
|
|
{ as: asComp = 'div', children, className, preWrap, jumboEmoji, emote, notice, ...props },
|
|
ref
|
|
) => (
|
|
<Text
|
|
as={asComp}
|
|
size="T400"
|
|
priority={notice ? '300' : '400'}
|
|
className={classNames(css.MessageTextBody({ preWrap, jumboEmoji, emote }), className)}
|
|
{...props}
|
|
ref={ref}
|
|
dir="auto"
|
|
>
|
|
{children}
|
|
</Text>
|
|
)
|
|
);
|