Skip to content

Instantly share code, notes, and snippets.

@gbluv
Last active February 22, 2026 22:59
Show Gist options
  • Select an option

  • Save gbluv/03e99615da34a52b60ac900e9cc9d6c9 to your computer and use it in GitHub Desktop.

Select an option

Save gbluv/03e99615da34a52b60ac900e9cc9d6c9 to your computer and use it in GitHub Desktop.
FullWorkingActivityIndicator
import { useEffect } from "react";
const styles = `
.lgbWrapper {
position: relative;
display: flex;
isolation: isolate;
width: 100%;
height: 100%;
overflow: hidden;
align-items: stretch;
border-radius: inherit;
}
.lgbRing {
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
user-select: none;
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
mask-composite: exclude;
z-index: 1;
}
.lgbContent {
position: relative;
z-index: 2;
border-radius: inherit;
flex: 1;
min-width: 0;
min-height: 0;
}
.lgbInnerGlow {
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
user-select: none;
z-index: 3;
}
`;
let injected = false;
function useStyles() {
useEffect(() => {
if (injected) return;
const el = document.createElement("style");
el.textContent = styles;
document.head.appendChild(el);
injected = true;
}, []);
}
// ─── LiquidGlassBorder ───────────────────────────────────────────────────────
export function LiquidGlassBorder({
children,
borderRadius = 44,
borderWidth = 1.575,
intensity = 1,
style,
className,
}) {
useStyles();
const k = Math.max(0, Math.min(2, intensity));
const bw = Math.max(0.5, borderWidth);
const ringGradient = `conic-gradient(from 180deg at 50% 50%,
hsl(330 90% 82% / ${(0.00*k+0.00).toFixed(2)}) 0deg,
hsl(320 90% 80% / ${(0.65*k+0.30).toFixed(2)}) 18deg,
hsl(295 88% 78% / ${(0.80*k+0.40).toFixed(2)}) 38deg,
hsl(265 90% 78% / ${(0.90*k+0.50).toFixed(2)}) 65deg,
hsl(235 95% 80% / ${(0.95*k+0.55).toFixed(2)}) 95deg,
hsl(215 100% 88% / ${Math.min(1,1.00*k+0.60).toFixed(2)}) 118deg,
hsl(210 100% 90% / ${Math.min(1,0.95*k+0.55).toFixed(2)}) 138deg,
hsl(235 95% 80% / ${(0.70*k+0.35).toFixed(2)}) 165deg,
hsl(265 90% 78% / ${(0.45*k+0.18).toFixed(2)}) 195deg,
hsl(295 88% 78% / ${(0.25*k+0.06).toFixed(2)}) 225deg,
hsl(320 90% 80% / ${(0.08*k+0.00).toFixed(2)}) 260deg,
hsl(330 90% 82% / 0.00) 300deg,
hsl(330 90% 82% / 0.00) 360deg)`;
const glowShadows = [
`inset -8px 0px 14px -8px hsl(205 100% 78% / ${Math.min(0.85,0.75*k).toFixed(2)})`,
`inset -4px 0px 7px -5px hsl(210 100% 88% / ${Math.min(0.70,0.60*k).toFixed(2)})`,
`inset -6px -6px 11px -7px hsl(240 90% 78% / ${Math.min(0.75,0.65*k).toFixed(2)})`,
`inset 0px -8px 14px -8px hsl(265 88% 75% / ${Math.min(0.75,0.65*k).toFixed(2)})`,
`inset 8px 0px 14px -8px hsl(285 85% 72% / ${Math.min(0.70,0.60*k).toFixed(2)})`,
`inset 6px 6px 11px -7px hsl(310 82% 70% / ${Math.min(0.65,0.55*k).toFixed(2)})`,
`inset 0px 6px 9px -6px hsl(330 80% 70% / ${Math.min(0.50,0.40*k).toFixed(2)})`,
].join(", ");
return (
<div
className={`lgbWrapper${className ? ` ${className}` : ""}`}
style={{ borderRadius, ...style }}
>
<div
aria-hidden="true"
className="lgbRing"
style={{ padding: bw, background: ringGradient }}
/>
<div className="lgbContent">{children}</div>
<div
aria-hidden="true"
className="lgbInnerGlow"
style={{ boxShadow: glowShadows }}
/>
</div>
);
}
// ─── Demo ─────────────────────────────────────────────────────────────────────
export default function App() {
return (
<div style={{
minHeight: "100vh",
background: "radial-gradient(ellipse 90% 80% at 25% 15%, #12091e 0%, #07050f 50%, #020105 100%)",
display: "flex",
alignItems: "center",
justifyContent: "center",
fontFamily: "system-ui, sans-serif",
}}>
<div style={{ width: "min(340px, 90vw)" }}>
<LiquidGlassBorder borderRadius={44}>
<div style={{
padding: "28px 36px",
background: "rgba(255,255,255,0.04)",
backdropFilter: "blur(24px)",
borderRadius: 44,
}}>
<p style={{ margin: 0, fontSize: 13, color: "rgba(255,255,255,0.4)" }}>Monday, September 9</p>
<p style={{ margin: "4px 0 0", fontSize: 52, fontWeight: 200, color: "#fff", letterSpacing: "-0.03em" }}>9:41</p>
</div>
</LiquidGlassBorder>
</div>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment