2023-10-06 04:44:06 +02:00
|
|
|
import { createVar, keyframes, style, styleVariants } from '@vanilla-extract/css';
|
|
|
|
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
|
|
|
import { DefaultReset, color, config, toRem } from 'folds';
|
|
|
|
|
|
|
|
export const StickySection = style({
|
|
|
|
position: 'sticky',
|
|
|
|
top: config.space.S100,
|
|
|
|
});
|
|
|
|
|
|
|
|
const SpacingVar = createVar();
|
|
|
|
const SpacingVariant = styleVariants({
|
|
|
|
'0': {
|
|
|
|
vars: {
|
|
|
|
[SpacingVar]: config.space.S0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'100': {
|
|
|
|
vars: {
|
|
|
|
[SpacingVar]: config.space.S100,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'200': {
|
|
|
|
vars: {
|
|
|
|
[SpacingVar]: config.space.S200,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'300': {
|
|
|
|
vars: {
|
|
|
|
[SpacingVar]: config.space.S300,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'400': {
|
|
|
|
vars: {
|
|
|
|
[SpacingVar]: config.space.S400,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'500': {
|
|
|
|
vars: {
|
|
|
|
[SpacingVar]: config.space.S500,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const highlightAnime = keyframes({
|
|
|
|
'0%': {
|
|
|
|
backgroundColor: color.Primary.Container,
|
|
|
|
},
|
|
|
|
'25%': {
|
|
|
|
backgroundColor: color.Primary.ContainerActive,
|
|
|
|
},
|
|
|
|
'50%': {
|
|
|
|
backgroundColor: color.Primary.Container,
|
|
|
|
},
|
|
|
|
'75%': {
|
|
|
|
backgroundColor: color.Primary.ContainerActive,
|
|
|
|
},
|
|
|
|
'100%': {
|
|
|
|
backgroundColor: color.Primary.Container,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
const HighlightVariant = styleVariants({
|
|
|
|
true: {
|
|
|
|
animation: `${highlightAnime} 2000ms ease-in-out`,
|
2024-05-31 16:19:46 +02:00
|
|
|
animationIterationCount: 'infinite',
|
2023-10-06 04:44:06 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const SelectedVariant = styleVariants({
|
|
|
|
true: {
|
|
|
|
backgroundColor: color.Surface.ContainerActive,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const AutoCollapse = style({
|
|
|
|
selectors: {
|
|
|
|
[`&+&`]: {
|
|
|
|
marginTop: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export const MessageBase = recipe({
|
|
|
|
base: [
|
|
|
|
DefaultReset,
|
|
|
|
{
|
|
|
|
marginTop: SpacingVar,
|
|
|
|
padding: `${config.space.S100} ${config.space.S200} ${config.space.S100} ${config.space.S400}`,
|
|
|
|
borderRadius: `0 ${config.radii.R400} ${config.radii.R400} 0`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
variants: {
|
|
|
|
space: SpacingVariant,
|
|
|
|
collapse: {
|
|
|
|
true: {
|
|
|
|
marginTop: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
autoCollapse: {
|
|
|
|
true: AutoCollapse,
|
|
|
|
},
|
|
|
|
highlight: HighlightVariant,
|
|
|
|
selected: SelectedVariant,
|
|
|
|
},
|
|
|
|
defaultVariants: {
|
|
|
|
space: '400',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export type MessageBaseVariants = RecipeVariants<typeof MessageBase>;
|
|
|
|
|
|
|
|
export const CompactHeader = style([
|
|
|
|
DefaultReset,
|
|
|
|
StickySection,
|
|
|
|
{
|
|
|
|
maxWidth: toRem(170),
|
|
|
|
width: '100%',
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
|
|
|
|
export const AvatarBase = style({
|
|
|
|
paddingTop: toRem(4),
|
|
|
|
transition: 'transform 200ms cubic-bezier(0, 0.8, 0.67, 0.97)',
|
2023-10-24 13:21:39 +02:00
|
|
|
alignSelf: 'start',
|
2023-10-06 04:44:06 +02:00
|
|
|
|
|
|
|
selectors: {
|
|
|
|
'&:hover': {
|
|
|
|
transform: `translateY(${toRem(-4)})`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export const ModernBefore = style({
|
|
|
|
minWidth: toRem(36),
|
|
|
|
});
|
|
|
|
|
|
|
|
export const BubbleBefore = style([ModernBefore]);
|
|
|
|
|
|
|
|
export const BubbleContent = style({
|
|
|
|
maxWidth: toRem(800),
|
|
|
|
padding: config.space.S200,
|
|
|
|
backgroundColor: color.SurfaceVariant.Container,
|
|
|
|
color: color.SurfaceVariant.OnContainer,
|
|
|
|
borderRadius: config.radii.R400,
|
|
|
|
});
|
|
|
|
|
|
|
|
export const Username = style({
|
|
|
|
overflow: 'hidden',
|
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
textOverflow: 'ellipsis',
|
|
|
|
selectors: {
|
2024-05-31 16:19:46 +02:00
|
|
|
'button&': {
|
|
|
|
cursor: 'pointer',
|
|
|
|
},
|
|
|
|
'button&:hover, button&:focus-visible': {
|
2023-10-06 04:44:06 +02:00
|
|
|
textDecoration: 'underline',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
2023-10-29 21:14:58 +01:00
|
|
|
|
|
|
|
export const MessageTextBody = recipe({
|
|
|
|
base: {
|
|
|
|
wordBreak: 'break-word',
|
|
|
|
},
|
|
|
|
variants: {
|
|
|
|
preWrap: {
|
|
|
|
true: {
|
|
|
|
whiteSpace: 'pre-wrap',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
jumboEmoji: {
|
|
|
|
true: {
|
|
|
|
fontSize: '1.504em',
|
|
|
|
lineHeight: '1.4962em',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
emote: {
|
|
|
|
true: {
|
|
|
|
color: color.Success.Main,
|
|
|
|
fontStyle: 'italic',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export type MessageTextBodyVariants = RecipeVariants<typeof MessageTextBody>;
|