Zephora UI

தீம் அமைப்பு

தீம்கள் என்பவை --z-* CSS custom properties-ஆகத் தொகுக்கப்படும் எளிய TypeScript objects. தீமை மாற்றுவது மாறிகளை மீண்டும் எழுதுகிறது — உடனடியாக, CSS-in-JS இல்லாமல், ஸ்டைல்களுக்கு re-render செலவின்றி.

தயாராக வரும் தீம்கள்

import { lightTheme, darkTheme, auraTheme, materialTheme } from "@zephora/theme";

createTheme

import { createTheme, lightTheme } from "@zephora/theme";

const brand = createTheme(lightTheme, {
  name: "brand",
  colors: {
    primary: "#0f766e",
    primaryHover: "#115e59",
    ring: "#14b8a6",
  },
  radius: "0.75rem",
});

Scoped மற்றும் global

// Scoped — wraps a subtree in a themed scope element
<ThemeProvider theme={brand}>...</ThemeProvider>

// Global — writes variables onto <html>, ideal for app-level switching
import { applyTheme } from "@zephora/theme";
applyTheme(brand);

CSS அளவிலான override-கள்

காம்பொனென்ட்கள் மாறிகளை நேரடியாகப் படிக்கின்றன, எனவே எந்த CSS விதியும் எந்த subtree-ஐயும் மீண்டும் தீம் செய்யலாம்:

.marketing-section {
  --z-primary: #ea580c;
  --z-radius: 9999px;
}

இருண்ட பயன்முறை

const [scheme, setScheme] = useState<"light" | "dark">("light");
<ThemeProvider theme={scheme === "dark" ? darkTheme : lightTheme} global>
  <App />
</ThemeProvider>