Put the constant into constants/chat-width.ts

This commit is contained in:
Imad Saddik 2026-01-03 08:40:21 +01:00
parent 00e6cafda6
commit 36f334f4af
3 changed files with 35 additions and 30 deletions

View File

@ -6,7 +6,11 @@
import { Input } from '$lib/components/ui/input';
import { cn } from '$lib/components/ui/utils';
import { tick } from 'svelte';
import { CUSTOM_WIDTH_PRESETS, MIN_CUSTOM_WIDTH, MAX_CUSTOM_WIDTH } from '$lib/utils/chat-width';
import {
CUSTOM_WIDTH_PRESETS,
MIN_CUSTOM_WIDTH,
MAX_CUSTOM_WIDTH
} from '$lib/constants/chat-width';
interface Props {
value: string;
@ -148,7 +152,7 @@
</Popover.Root>
{#if isEditing}
<div class="flex animate-in items-start gap-2 duration-200 fade-in slide-in-from-top-1">
<div class="animate-in fade-in slide-in-from-top-1 flex items-start gap-2 duration-200">
<div class="flex-1 space-y-1">
<Input
bind:ref={inputRef}

View File

@ -0,0 +1,28 @@
export const DEFAULT_WIDTH = 'max-w-[48rem]';
export const MIN_CUSTOM_WIDTH = 300;
export const MAX_CUSTOM_WIDTH = 10000;
export const AUTO_WIDTH_CLASSES = `
max-w-[48rem]
md:max-w-[60rem]
xl:max-w-[70rem]
2xl:max-w-[80rem]
3xl:max-w-[90rem]
4xl:max-w-[100rem]
5xl:max-w-[150rem]
`;
export const CUSTOM_WIDTH_PRESETS = {
xs: 480,
sm: 600,
md: 768,
lg: 960,
xl: 1152,
'2xl': 1280,
'3xl': 1440,
'4xl': 1600,
'5xl': 1920,
'6xl': 2304,
'7xl': 3072
} as const;

View File

@ -1,31 +1,4 @@
export const DEFAULT_WIDTH = 'max-w-[48rem]';
export const MIN_CUSTOM_WIDTH = 300;
export const MAX_CUSTOM_WIDTH = 10000;
export const AUTO_WIDTH_CLASSES = `
max-w-[48rem]
md:max-w-[60rem]
xl:max-w-[70rem]
2xl:max-w-[80rem]
3xl:max-w-[90rem]
4xl:max-w-[100rem]
5xl:max-w-[150rem]
`;
export const CUSTOM_WIDTH_PRESETS = {
xs: 480,
sm: 600,
md: 768,
lg: 960,
xl: 1152,
'2xl': 1280,
'3xl': 1440,
'4xl': 1600,
'5xl': 1920,
'6xl': 2304,
'7xl': 3072
} as const;
import { AUTO_WIDTH_CLASSES, CUSTOM_WIDTH_PRESETS, DEFAULT_WIDTH } from '$lib/constants/chat-width';
export type CustomWidthPreset = keyof typeof CUSTOM_WIDTH_PRESETS;