glass mode

This commit is contained in:
hamid zarghami
2026-06-21 12:58:29 +03:30
parent d3ef8e1a98
commit b5653906dc
17 changed files with 325 additions and 211 deletions
+7 -3
View File
@@ -40,15 +40,19 @@ export const isCustomImageBackground = (
export const isPatternBackground = (settings: RestaurantBackgroundSettings): boolean =>
Boolean(settings.bgUrl) && !isCustomImageBackground(settings);
export const colorizeSvg = (svg: string, color: string): string => {
export const colorizeSvg = (
svg: string,
color: string,
vectorOpacity: number = PATTERN_VECTOR_OPACITY,
): string => {
let result = svg.replace(/fill="(?!black|none)[^"]+"/g, `fill="${color}"`);
result = result.replace(
/fill-opacity="[^"]+"/g,
`fill-opacity="${PATTERN_VECTOR_OPACITY}"`,
`fill-opacity="${vectorOpacity}"`,
);
result = result.replace(
/(<(?:path|circle|rect|ellipse|polygon)[^>]*fill="(?!black|none)[^"]+")(?![^>]*fill-opacity)/g,
`$1 fill-opacity="${PATTERN_VECTOR_OPACITY}"`,
`$1 fill-opacity="${vectorOpacity}"`,
);
return result;
};
+22
View File
@@ -0,0 +1,22 @@
import clsx, { type ClassValue } from "clsx";
export const GLASS_SURFACE = "glass-surface";
export const GLASS_SURFACE_FLAT = "glass-surface--flat";
export const GLASS_SURFACE_SELECTED = "glass-surface--selected";
export const GLASS_SURFACE_NAV = "glass-surface-nav";
export function glassSurfaceNav(...extra: ClassValue[]) {
return clsx(GLASS_SURFACE_NAV, extra);
}
export function glassSurface(...extra: ClassValue[]) {
return clsx(GLASS_SURFACE, extra);
}
export function glassSurfaceFlat(...extra: ClassValue[]) {
return clsx(GLASS_SURFACE, GLASS_SURFACE_FLAT, extra);
}
export function glassSurfaceSelected(...extra: ClassValue[]) {
return clsx(GLASS_SURFACE, GLASS_SURFACE_SELECTED, extra);
}