fix: polish login backdrop and wordmark (#6687)
This commit is contained in:
1 parent
e7c8e2e01e
commit
c9a48fa23f
2 files changed
+21
-11
No files matched your search
@@ -31,11 +31,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.marqueeRail {
|
.marqueeRail {
|
||||||
|
--marquee-horizontal-mask: linear-gradient(black, black);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -14rem;
|
top: -14rem;
|
||||||
bottom: -14rem;
|
bottom: -14rem;
|
||||||
width: clamp(22rem, 26vw, 32rem);
|
width: clamp(22rem, 26vw, 32rem);
|
||||||
mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
|
mask-image:
|
||||||
|
linear-gradient(to bottom, transparent, black 10%, black 90%, transparent), var(--marquee-horizontal-mask);
|
||||||
|
mask-composite: intersect;
|
||||||
}
|
}
|
||||||
|
|
||||||
.marqueeRail > * {
|
.marqueeRail > * {
|
||||||
@@ -46,12 +49,14 @@
|
|||||||
.marqueeRailLeft {
|
.marqueeRailLeft {
|
||||||
left: -7rem;
|
left: -7rem;
|
||||||
--integration-marquee-accent: var(--studio-glow-color);
|
--integration-marquee-accent: var(--studio-glow-color);
|
||||||
|
--marquee-horizontal-mask: linear-gradient(to right, black 55%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.marqueeRailRight {
|
.marqueeRailRight {
|
||||||
right: -7rem;
|
right: -7rem;
|
||||||
top: -22rem;
|
top: -22rem;
|
||||||
--integration-marquee-accent: var(--studio-secondary-glow-color);
|
--integration-marquee-accent: var(--studio-secondary-glow-color);
|
||||||
|
--marquee-horizontal-mask: linear-gradient(to left, black 55%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.shell {
|
.shell {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import type { CSSProperties, MouseEvent as ReactMouseEvent } from "react";
|
import type { CSSProperties } from "react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useComputedColorScheme } from "@mantine/core";
|
|
||||||
import confetti from "canvas-confetti";
|
import confetti from "canvas-confetti";
|
||||||
|
|
||||||
import HomarrWordmarkLight from "./homarr-wordmark-light";
|
import HomarrWordmarkLight from "./homarr-wordmark-light";
|
||||||
@@ -15,21 +14,23 @@ interface OnboardingWordmarkProps {
|
|||||||
large?: boolean;
|
large?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defaultWordmarkUrl = "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/homarr-wordmark-light.svg";
|
||||||
|
|
||||||
export const OnboardingWordmark = ({ primaryColor, secondaryColor, large = false }: OnboardingWordmarkProps) => {
|
export const OnboardingWordmark = ({ primaryColor, secondaryColor, large = false }: OnboardingWordmarkProps) => {
|
||||||
const [celebrating, setCelebrating] = useState(false);
|
const [celebrating, setCelebrating] = useState(false);
|
||||||
const colorScheme = useComputedColorScheme("light");
|
|
||||||
const sounds = useOnboardingSounds();
|
const sounds = useOnboardingSounds();
|
||||||
|
const className = `${classes.wordmark} ${classes.onboardingWordmark} ${large ? classes.welcomeWordmark : ""} ${celebrating ? classes.celebratingWordmark : ""}`;
|
||||||
const colors = {
|
const colors = {
|
||||||
"--homarr-wordmark-primary": primaryColor ?? "#F92424",
|
"--homarr-wordmark-primary": primaryColor ?? "#F92424",
|
||||||
"--homarr-wordmark-secondary": secondaryColor ?? "#FA5252",
|
"--homarr-wordmark-secondary": secondaryColor ?? "#FA5252",
|
||||||
"--homarr-wordmark-foreground": colorScheme === "light" ? "#1A1B1E" : "#FEFDFD",
|
"--homarr-wordmark-foreground": "#FEFDFD",
|
||||||
} as CSSProperties;
|
} as CSSProperties;
|
||||||
|
|
||||||
const celebrate = (event: ReactMouseEvent<SVGSVGElement>) => {
|
const celebrate = (logoElement: Element) => {
|
||||||
sounds.hover();
|
sounds.hover();
|
||||||
const logo = event.currentTarget.getBoundingClientRect();
|
const logo = logoElement.getBoundingClientRect();
|
||||||
const originY = (logo.top + logo.height / 2) / window.innerHeight;
|
const originY = (logo.top + logo.height / 2) / window.innerHeight;
|
||||||
const colors = primaryColor && secondaryColor ? [primaryColor, secondaryColor] : undefined;
|
const confettiColors = primaryColor && secondaryColor ? [primaryColor, secondaryColor] : undefined;
|
||||||
|
|
||||||
if (!window.matchMedia("(prefers-reduced-motion: reduce)").matches) setCelebrating(true);
|
if (!window.matchMedia("(prefers-reduced-motion: reduce)").matches) setCelebrating(true);
|
||||||
for (const { angle, originX } of [
|
for (const { angle, originX } of [
|
||||||
@@ -45,19 +46,23 @@ export const OnboardingWordmark = ({ primaryColor, secondaryColor, large = false
|
|||||||
ticks: 90,
|
ticks: 90,
|
||||||
scalar: 0.8,
|
scalar: 0.8,
|
||||||
origin: { x: originX / window.innerWidth, y: originY },
|
origin: { x: originX / window.innerWidth, y: originY },
|
||||||
colors,
|
colors: confettiColors,
|
||||||
disableForReducedMotion: true,
|
disableForReducedMotion: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (primaryColor === undefined && secondaryColor === undefined) {
|
||||||
|
return <img src={defaultWordmarkUrl} alt="Homarr" width={1477} height={1054} className={className} />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomarrWordmarkLight
|
<HomarrWordmarkLight
|
||||||
role="img"
|
role="img"
|
||||||
aria-label="Homarr"
|
aria-label="Homarr"
|
||||||
style={colors}
|
style={colors}
|
||||||
className={`${classes.wordmark} ${classes.onboardingWordmark} ${large ? classes.welcomeWordmark : ""} ${celebrating ? classes.celebratingWordmark : ""}`}
|
className={className}
|
||||||
onMouseEnter={celebrate}
|
onMouseEnter={(event) => celebrate(event.currentTarget)}
|
||||||
onAnimationEnd={() => setCelebrating(false)}
|
onAnimationEnd={() => setCelebrating(false)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user