Performance
À surveillerFréquence d'images: 60 i/s en moyenne, p5 59.5 · Tâches longues: 0 tâches, 0 ms au total, plus longue 0 ms · Source gzip 7.3 KB · À l'exécution 317 KB
Sleep TrackerMITCarteAnimata
Composant React Carte par Animata. Repris sans modification depuis Animata sous licence MIT et présenté ici en direct.
Rapport qualite
La note et le score proviennent de contrôles automatiques lancés à la compilation ou aux tests. Si un contrôle n'a pas été exécuté, il est indiqué Non testé — aucun chiffre n'est inventé.
Fréquence d'images: 60 i/s en moyenne, p5 59.5 · Tâches longues: 0 tâches, 0 ms au total, plus longue 0 ms · Source gzip 7.3 KB · À l'exécution 317 KB
Problemes 0 · Lecteur d'écran: Reussi
Pas de mouvement continu
Pas de debordement
La fréquence d'images et les tâches longues ont été mesurées dans Chromium sans interface, avec un WebGL logiciel. Elles ne sont comparables qu'entre composants de ce site, et ne représentent pas un appareil réel.
Sans objet : aucune animation visible au repos. Les animations déclenchées au survol n'ont pas été testées.
Aucune violation axe-core.

Controle le 15 nov. 2026 · Les chiffres viennent d'un script automatique, pas d'exemples ecrits a la main.
Affiché à taille réelle.
La copie commence par la notice de licence. Gardez-la lorsque vous utilisez le code.
<div id="root"></div>:root{--bg:#f6f4f0;--ink:#17181a;--background:40 20% 96%;--foreground:24 10% 8%;--card:0 0% 100%}html,body{min-height:100%;margin:0;background:var(--bg);color:var(--ink)}html,body{height:100%;overflow:hidden}body{display:grid;place-items:center}#root{display:grid;place-items:center;max-width:100%;max-height:100%;box-sizing:border-box;padding:16px;color:hsl(var(--foreground))}#root.full{width:100%;height:100%;padding:0}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-play-state:paused!important;transition-duration:0s!important}}
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-duration:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:"Paper Mono", ui-monospace, monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-500:oklch(63.7% .237 25.331);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-500:oklch(79.5% .184 86.047);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-slate-800:oklch(27.9% .041 260.031);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-600:oklch(44.6% .03 256.802);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-950:oklch(14.1% .005 285.823);--color-white:#fff;--spacing:.25rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--radius-md:calc(var(--radius) - 2px);--radius-xl:.75rem;--radius-3xl:1.5rem;--ease-out:cubic-bezier(.22, 1, .36, 1);--default-transition-duration:.2s;--default-transition-timing-function:var(--ease-out);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-border:hsl(var(--border));--color-background:hsl(var(--background));--color-foreground:hsl(var(--foreground));--color-primary:hsl(var(--primary));--color-muted-foreground:hsl(var(--muted-foreground));--ease-apple:cubic-bezier(.4, 0, .6, 1)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--color-border)}body{background-color:var(--color-background);color:var(--color-foreground)}:root{--background:0 0% 100%;--foreground:0 0% 11%;--card:0 0% 100%;--card-foreground:0 0% 11%;--popover:0 0% 100%;--popover-foreground:0 0% 11%;--primary:0 0% 11%;--primary-foreground:0 0% 100%;--secondary:0 0% 96%;--secondary-foreground:0 0% 11%;--muted:0 0% 96%;--muted-foreground:0 0% 43%;--accent:262 83% 58%;--accent-foreground:0 0% 100%;--destructive:0 84% 60%;--destructive-foreground:0 0% 98%;--border:0 0% 90%;--input:0 0% 90%;--ring:262 83% 58%;--radius:.75rem;--surface-alt:0 0% 96%;--surface-card:0 0% 100%;--surface-dark:0 0% 7%;--text-secondary:0 0% 43%;--ink:#76756f;--ink-faint:#e3e3e3;--link:210 100% 40%;--link-hover:210 100% 32%;--shadow-sm:0 1px 2px #0000000d;--shadow-md:0 2px 8px #0000000f, 0 4px 16px #0000000a;--shadow-lg:0 4px 12px #0000000f, 0 12px 32px #00000014;--footer-surface:#f5f5f7;--footer-ink:#0f1d42;--footer-ink-muted:#1a2d5c;--footer-accent:#1a4fff;--footer-gold:#fc0;--footer-category-title:#1d1d1f;--footer-category-link:#515154;--footer-stamp:#9f9f9f}.dark{--background:0 0% 0%;--foreground:0 0% 96%;--card:0 0% 4%;--card-foreground:0 0% 96%;--popover:0 0% 4%;--popover-foreground:0 0% 96%;--primary:0 0% 96%;--primary-foreground:0 0% 0%;--secondary:0 0% 10%;--secondary-foreground:0 0% 96%;--muted:0 0% 10%;--muted-foreground:0 0% 45%;--accent:262 83% 65%;--accent-foreground:0 0% 100%;--destructive:0 62% 30%;--destructive-foreground:0 0% 98%;--border:0 0% 12%;--input:0 0% 12%;--ring:262 83% 65%;--surface-alt:0 0% 4%;--surface-card:0 0% 6%;--surface-dark:0 0% 2%;--text-secondary:0 0% 55%;--ink:#e3e3e3;--ink-faint:#76756f;--link:262 80% 70%;--link-hover:262 80% 80%;--shadow-sm:none;--shadow-md:none;--shadow-lg:none;--footer-surface:#1d1d1f;--footer-ink:#f5f5f7;--footer-ink-muted:#86868b;--footer-accent:#fc0;--footer-gold:#fc0;--footer-category-title:#f5f5f7;--footer-category-link:#86868b;--footer-stamp:#48484a}}@layer components{.text-animator-demo .text-animation-stage,[data-text-animator-demo] .text-animation-stage{perspective:900px;padding:clamp(1rem,5cqi,1.5rem);font-size:clamp(1rem,10cqi,2rem);font-weight:500;line-height:1.1}.text-animator-demo .text-animation-title,.text-animator-demo .text-animation-kinetic-word,[data-text-animator-demo] .text-animation-title,[data-text-animator-demo] .text-animation-kinetic-word{text-align:center;letter-spacing:-.025em}.text-animator-demo .text-animation-title,[data-text-animator-demo] .text-animation-title{text-wrap:balance;font-variant-numeric:tabular-nums}}@layer utilities{.relative{position:relative}.mt-2{margin-top:calc(var(--spacing) * 2)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.box-border{box-sizing:border-box}.flex{display:flex}.size-52{width:calc(var(--spacing) * 52);height:calc(var(--spacing) * 52)}.h-2{height:calc(var(--spacing) * 2)}.h-4{height:calc(var(--spacing) * 4)}.h-16{height:calc(var(--spacing) * 16)}.h-full{height:100%}.min-h-4{min-height:calc(var(--spacing) * 4)}.w-2{width:calc(var(--spacing) * 2)}.w-4{width:calc(var(--spacing) * 4)}.w-full{width:100%}.flex-1{flex:1}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-evenly{justify-content:space-evenly}.gap-3{gap:calc(var(--spacing) * 3)}.gap-\[2px\]{gap:2px}.overflow-hidden{overflow:hidden}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-full{border-radius:2147483647px}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-gray-200{border-color:var(--color-gray-200)}.bg-blue-600\/15{background-color:#155dfc26}@supports (color:color-mix(in lab, red, red)){.bg-blue-600\/15{background-color:color-mix(in oklab, var(--color-blue-600) 15%, transparent)}}.bg-blue-600\/20{background-color:#155dfc33}@supports (color:color-mix(in lab, red, red)){.bg-blue-600\/20{background-color:color-mix(in oklab, var(--color-blue-600) 20%, transparent)}}.bg-blue-600\/25{background-color:#155dfc40}@supports (color:color-mix(in lab, red, red)){.bg-blue-600\/25{background-color:color-mix(in oklab, var(--color-blue-600) 25%, transparent)}}.bg-blue-600\/30{background-color:#155dfc4d}@supports (color:color-mix(in lab, red, red)){.bg-blue-600\/30{background-color:color-mix(in oklab, var(--color-blue-600) 30%, transparent)}}.bg-blue-600\/45{background-color:#155dfc73}@supports (color:color-mix(in lab, red, red)){.bg-blue-600\/45{background-color:color-mix(in oklab, var(--color-blue-600) 45%, transparent)}}.bg-blue-600\/70{background-color:#155dfcb3}@supports (color:color-mix(in lab, red, red)){.bg-blue-600\/70{background-color:color-mix(in oklab, var(--color-blue-600) 70%, transparent)}}.bg-blue-600\/85{background-color:#155dfcd9}@supports (color:color-mix(in lab, red, red)){.bg-blue-600\/85{background-color:color-mix(in oklab, var(--color-blue-600) 85%, transparent)}}.bg-blue-600\/90{background-color:#155dfce6}@supports (color:color-mix(in lab, red, red)){.bg-blue-600\/90{background-color:color-mix(in oklab, var(--color-blue-600) 90%, transparent)}}.bg-red-50{background-color:var(--color-red-50)}.bg-red-500{background-color:var(--color-red-500)}.bg-white{background-color:var(--color-white)}.object-cover{object-fit:cover}.p-4{padding:calc(var(--spacing) * 4)}.pt-1{padding-top:var(--spacing)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-gray-600{color:var(--color-gray-600)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-primary{color:var(--color-primary)}.opacity-70{opacity:.7}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.dark\:border-zinc-700:where(.dark,.dark *){border-color:var(--color-zinc-700)}.dark\:bg-blue-300\/15:where(.dark,.dark *){background-color:#90c5ff26}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-300\/15:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-300) 15%, transparent)}}.dark\:bg-blue-300\/20:where(.dark,.dark *){background-color:#90c5ff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-300\/20:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-300) 20%, transparent)}}.dark\:bg-blue-300\/30:where(.dark,.dark *){background-color:#90c5ff4d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-300\/30:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-300) 30%, transparent)}}.dark\:bg-blue-300\/45:where(.dark,.dark *){background-color:#90c5ff73}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-300\/45:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-300) 45%, transparent)}}.dark\:bg-blue-300\/70:where(.dark,.dark *){background-color:#90c5ffb3}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-300\/70:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-300) 70%, transparent)}}.dark\:bg-blue-300\/85:where(.dark,.dark *){background-color:#90c5ffd9}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-300\/85:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-300) 85%, transparent)}}.dark\:bg-blue-300\/90:where(.dark,.dark *){background-color:#90c5ffe6}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-300\/90:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-300) 90%, transparent)}}.dark\:bg-blue-400\/15:where(.dark,.dark *){background-color:#54a2ff26}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/15:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-400) 15%, transparent)}}.dark\:bg-blue-400\/20:where(.dark,.dark *){background-color:#54a2ff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-400) 20%, transparent)}}.dark\:bg-blue-400\/25:where(.dark,.dark *){background-color:#54a2ff40}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/25:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-400) 25%, transparent)}}.dark\:bg-blue-400\/45:where(.dark,.dark *){background-color:#54a2ff73}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/45:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-400) 45%, transparent)}}.dark\:bg-slate-800:where(.dark,.dark *){background-color:var(--color-slate-800)}.dark\:text-white:where(.dark,.dark *){color:var(--color-white)}@keyframes orbit-move{0%{transform:translate(-50%,-50%)rotateY(-40deg)rotateX(70deg)rotate(0)translate(100px)}to{transform:translate(-50%,-50%)rotateY(-40deg)rotateX(70deg)rotate(360deg)translate(100px)}}@keyframes counter-rotate{0%{opacity:1;transform:rotate(0)rotateX(-70deg)rotateY(40deg)scale(1)}25%{opacity:1;transform:rotate(-90deg)rotateX(-70deg)rotateY(40deg)scale(1.2)}50%{opacity:.3;transform:rotate(-180deg)rotateX(-70deg)rotateY(40deg)scale(.8)}75%{opacity:.3;transform:rotate(-270deg)rotateX(-70deg)rotateY(40deg)scale(.8)}to{opacity:1;transform:rotate(-360deg)rotateX(-70deg)rotateY(40deg)scale(1)}}@keyframes orbit-indexes{0%,25%,to{z-index:11}50%,99%{z-index:9}}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}.preview{margin-bottom:calc(var(--spacing) * 4)}.preview-light{background-color:#fefefe;background-image:radial-gradient(#efefef 1px,#0000 1px),radial-gradient(#efefef 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}.preview-dark{background-image:radial-gradient(#6a6a6a 1px,#0000 1px),radial-gradient(#6a6a6a 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}.component-list-item{border-color:var(--color-zinc-200);background-color:#fefefe;background-image:radial-gradient(#efefef 1px,#0000 1px),radial-gradient(#efefef 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}.dark .component-list-item{border-color:var(--color-zinc-700);background-color:var(--color-zinc-950);background-image:radial-gradient(#6a6a6a 1px,#0000 1px),radial-gradient(#6a6a6a 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}[style*="opacity: 1"]>.scroll-baby{color:var(--color-yellow-300)}[style*="opacity: 1"]>.scroll-baby:where(.dark,.dark *){color:var(--color-yellow-500)}[style*="opacity: 1"]>.scroll-file{color:var(--color-blue-300)}[style*="opacity: 1"]>.scroll-file:where(.dark,.dark *){color:var(--color-blue-500)}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}// animata source (MIT). npm i clsx react tailwind-merge · Tailwind CSS v4
// ── animata/graphs/bar-chart.tsx (https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/animata/graphs/bar-chart.tsx)
import { useEffect, useLayoutEffect, useRef, useState } from "react";
import { cn } from "@/lib/utils";
interface BarChartProps {
/**
* The items to display in the BarChart.
*/
items: {
progress: number;
label: string;
className?: string;
containerClassName?: string;
}[];
/**
* The height of the BarChart.
*/
height?: number;
className?: string;
}
export default function BarChart({ items, className, height: providedHeight }: BarChartProps) {
const containerRef = useRef<HTMLDivElement>(null);
const [measuredHeight, setMeasuredHeight] = useState<number | undefined>();
const height = providedHeight ?? measuredHeight ?? 12;
useLayoutEffect(() => {
if (providedHeight !== undefined || !containerRef.current) return;
const node = containerRef.current;
const updateHeight = () => setMeasuredHeight(node.offsetHeight);
updateHeight();
const observer = new ResizeObserver(updateHeight);
observer.observe(node);
return () => observer.disconnect();
}, [providedHeight]);
const [shouldUseValue, setShouldUseValue] = useState(false);
useEffect(() => {
const timeout = setTimeout(() => {
// This is a hack to force the animation to run for the first time.
// We can use framer-motion to achieve this but just keeping it simple for now.
setShouldUseValue(true);
}, 250);
return () => clearTimeout(timeout);
}, []);
return (
<div
ref={containerRef}
className={cn(
"relative box-border flex min-h-4 w-full flex-wrap items-end gap-[2px] overflow-hidden",
className,
)}
style={{ height }}
>
{items.map((item, index) => {
const clampedProgress = Math.min(100, Math.max(0, item.progress));
const barHeight = shouldUseValue ? (clampedProgress / 100) * height : 0;
return (
<div
className={cn("flex h-full flex-1 flex-col-reverse", item.containerClassName)}
key={`bar_${index}`}
title={item.label}
>
<div
style={{ height: barHeight }}
className={cn("transition-all duration-200", item.className)}
/>
</div>
);
})}
</div>
);
}
// ── animata/widget/sleep-tracker.tsx (https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/animata/widget/sleep-tracker.tsx)
"use client";
import BarChart from "@/animata/graphs/bar-chart";
interface ISleepTrackerProps {
items: {
progress: number;
label: string;
className?: string;
containerClassName?: string;
}[];
image: string;
}
export const testSleepTrackerProps: ISleepTrackerProps = {
items: [
{
label: "A",
progress: 45,
className: "rounded-md dark:bg-blue-400/45 bg-blue-600/45",
},
{
label: "B",
progress: 25,
className: "rounded-md dark:bg-blue-400/25 bg-blue-600/25",
},
{
label: "C",
progress: 15,
className: "rounded-md dark:bg-blue-400/15 bg-blue-600/15",
},
{
label: "B",
progress: 10,
className: "rounded-md dark:bg-blue-400/20 bg-blue-600/20",
},
{
label: "C",
progress: 15,
className: "rounded-md dark:bg-blue-300/15 bg-blue-600/15",
},
{
label: "D",
progress: 30,
className: "rounded-md dark:bg-blue-300/30 bg-blue-600/30",
},
{
label: "E",
progress: 70,
className: "rounded-md dark:bg-blue-300/70 bg-blue-600/70",
},
{
label: "A",
progress: 45,
className: "rounded-md dark:bg-blue-300/45 bg-blue-600/45",
},
{
label: "B",
progress: 10,
className: "rounded-md dark:bg-blue-300/20 bg-blue-600/20",
},
{
label: "C",
progress: 15,
className: "rounded-md dark:bg-blue-300/15 bg-blue-600/15",
},
{
label: "B",
progress: 10,
className: "rounded-md dark:bg-blue-300/20 bg-blue-600/20",
},
{
label: "B",
progress: 10,
className: "rounded-md dark:bg-blue-300/20 bg-blue-600/20",
},
{
label: "B",
progress: 10,
className: "rounded-md dark:bg-blue-300/20 bg-blue-600/20",
},
{
label: "C",
progress: 85,
className: "rounded-md dark:bg-blue-300/85 bg-blue-600/85",
},
{
label: "D",
progress: 90,
className: "rounded-md dark:bg-blue-300/90 bg-blue-600/90",
},
{
label: "E",
progress: 15,
className: "rounded-md dark:bg-blue-300/15 bg-blue-600/15",
},
],
image:
"https://plus.unsplash.com/premium_photo-1675107359574-e3ba5f47a1a2?q=80&w=1287&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
};
export default function SleepTracker({
items = testSleepTrackerProps.items,
image = testSleepTrackerProps.image,
}: ISleepTrackerProps) {
return (
<div className="flex size-52 flex-col justify-evenly rounded-3xl border border-gray-200 bg-white p-4 dark:border-zinc-700 dark:bg-slate-800">
<div className="mb-2 flex flex-row items-center gap-3">
<div className="icon flex h-4 w-4 items-center justify-center rounded-full bg-red-50">
<div className="inner-icon h-2 w-2 rounded-full bg-red-500"></div>
</div>
<p className="text-sm text-gray-600 dark:text-white">Sleep Tracker</p>
</div>
<img className="h-16 w-full rounded-xl object-cover" src={image} alt="Sleep Tracker" />
<BarChart className="pt-1" items={items} height={40} />
<div className="activity mt-2 flex flex-row justify-between text-sm">
<p className="text-primary opacity-70">Activity</p>
<p className="text-muted-foreground">
<strong>32m</strong> ago
</p>
</div>
</div>
);
}
// ── lib/utils.ts (https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/lib/utils.ts)
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function absoluteUrl(path: string) {
return `${process.env.NEXT_PUBLIC_APP_URL}${path}`;
}
// Linear interpolation
export function lerp(a: number, b: number, n: number) {
return (1 - n) * a + n * b;
}
// Get distance between two points
export function getDistance(x1: number, y1: number, x2: number, y2: number) {
return Math.hypot(x2 - x1, y2 - y1);
}Réglages · HTML · CSS · JS
Modifiez le code et ajustez-le avec les réglages. L'aperçu se met à jour pendant la saisie.
Ce composant tourne depuis un bundle compilé : son script est en lecture seule ici. Modifiez le HTML et le CSS ; la source complète est dans l'onglet Code.
Modifiez chaque composant en direct, ajustez-le avec des réglages, téléchargez la source complète et copiez les prompts avancés.
49 $ en une foisPrix provisoire
Mode test : aucun paiement réel.
Gratuit : aperçu, boutons de copie et notes de leçon.
Des marges généreuses, des coins doux et une seule couleur d’accent mettent le contenu en avant.
Listes de fonctions, profils, fiches produit et tableaux de bord.
Réglez la marge, la profondeur de l’ombre et la couleur d’accent.
Ajoute le composant « Sleep Tracker (Carte) » de Animata (github.com/codse/animata) (MIT) à mon application React + Tailwind CSS. Fichier source : https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/animata/widget/sleep-tracker.tsx. Des marges généreuses, des coins doux et une seule couleur d’accent mettent le contenu en avant. À utiliser pour : Listes de fonctions, profils, fiches produit et tableaux de bord. Réglages à ajuster : Réglez la marge, la profondeur de l’ombre et la couleur d’accent. Prends en charge les thèmes clair et sombre et respecte prefers-reduced-motion. Conserve la mention de licence MIT.
Un prompt plus long avec les étapes de réglage, d'accessibilité et d'intégration.