Order Confirmation

This commit is contained in:
tedraykov
2024-06-28 18:21:44 +03:00
parent 68039b1a6e
commit f4f6edcd9a
39 changed files with 2386 additions and 363 deletions

View File

@@ -3,6 +3,34 @@ import { ReadonlyURLSearchParams } from 'next/navigation';
import { twMerge } from 'tailwind-merge';
import { Menu } from './shopify/types';
export function cx(...args: ClassValue[]) {
return twMerge(clsx(...args));
}
export const focusInput = [
// base
'focus:ring-2',
// ring color
'focus:ring-blue-200 focus:dark:ring-blue-700/30',
// border color
'focus:border-blue-500 focus:dark:border-blue-700'
];
export const hasErrorInput = [
// base
'ring-2',
// border color
'border-red-500 dark:border-red-700',
// ring color
'ring-red-200 dark:ring-red-700/30'
];
export const focusRing = [
// base
'outline outline-offset-2 outline-0 focus-visible:outline-2',
// outline color
'outline-blue-500 dark:outline-blue-500'
];
export const createUrl = (pathname: string, params: URLSearchParams | ReadonlyURLSearchParams) => {
const paramsString = params.toString();
const queryString = `${paramsString.length ? '?' : ''}${paramsString}`;
@@ -96,13 +124,12 @@ export function toPrintDate(date: string) {
});
}
export const isBeforeToday = (date?: string | null) => {
export const isBeforeToday = (date?: Date | null) => {
if (!date) return false;
const today = new Date();
const compareDate = new Date(date);
today.setHours(0, 0, 0, 0);
compareDate.setHours(0, 0, 0, 0);
date.setHours(0, 0, 0, 0);
return compareDate <= today;
return date <= today;
};