nico-martin HF Staff commited on
Commit
8a573f8
·
1 Parent(s): d9f7125

added some intro animations

Browse files
Files changed (3) hide show
  1. src/App.tsx +7 -4
  2. src/Initialize.tsx +24 -10
  3. src/index.css +66 -0
src/App.tsx CHANGED
@@ -53,7 +53,7 @@ function App() {
53
  <span className="font-bold flex items-center justify-center gap-1">
54
  <img
55
  src="hf-logo.svg"
56
- alt="Gemma Logo"
57
  className="block"
58
  style={{
59
  width: "1.2em",
@@ -73,14 +73,17 @@ function App() {
73
  isInitializing={isInitializing}
74
  />
75
  )}
76
- <footer className="p-8 pt-0 text-center text-muted-foreground text-xs md:text-sm">
 
 
 
77
  <p>
78
  High-quality translations across 56 languages powered by{" "}
79
  <a
80
  href="https://blog.google/technology/developers/gemma-open-models/"
81
  target="_blank"
82
  rel="noopener noreferrer"
83
- className="text-primary hover:underline"
84
  >
85
  Google's TranslateGemma
86
  </a>{" "}
@@ -89,7 +92,7 @@ function App() {
89
  href="https://huggingface.co/docs/transformers.js"
90
  target="_blank"
91
  rel="noopener noreferrer"
92
- className="text-primary hover:underline"
93
  >
94
  Transformers.js
95
  </a>{" "}
 
53
  <span className="font-bold flex items-center justify-center gap-1">
54
  <img
55
  src="hf-logo.svg"
56
+ alt="Transformers.js Logo"
57
  className="block"
58
  style={{
59
  width: "1.2em",
 
73
  isInitializing={isInitializing}
74
  />
75
  )}
76
+ <footer
77
+ className="p-8 pt-0 text-center text-muted-foreground text-xs md:text-sm animate-fade-in"
78
+ style={{ animationDelay: "0.5s", opacity: 0 }}
79
+ >
80
  <p>
81
  High-quality translations across 56 languages powered by{" "}
82
  <a
83
  href="https://blog.google/technology/developers/gemma-open-models/"
84
  target="_blank"
85
  rel="noopener noreferrer"
86
+ className="text-primary hover:underline underline-offset-2 transition-all hover:underline-offset-4"
87
  >
88
  Google's TranslateGemma
89
  </a>{" "}
 
92
  href="https://huggingface.co/docs/transformers.js"
93
  target="_blank"
94
  rel="noopener noreferrer"
95
+ className="text-primary hover:underline underline-offset-2 transition-all hover:underline-offset-4"
96
  >
97
  Transformers.js
98
  </a>{" "}
src/Initialize.tsx CHANGED
@@ -17,12 +17,15 @@ export default function Initialize({
17
  className = "",
18
  }: InitializeProps) {
19
  return (
20
- <div className={cn("max-w-2xl mx-auto px-8", className)}>
21
  <div className="bg-white rounded-lg shadow-md p-8 border border-border">
22
  <div className="flex flex-col items-center gap-6">
23
  {/* Description */}
24
  <div className="space-y-4 text-left w-full">
25
- <div>
 
 
 
26
  <h3 className="font-semibold text-base mb-1">
27
  About TranslateGemma 4B
28
  </h3>
@@ -35,14 +38,17 @@ export default function Initialize({
35
  href="https://blog.google/innovation-and-ai/technology/developers-tools/translategemma/"
36
  target="_blank"
37
  rel="noopener noreferrer"
38
- className="text-primary hover:underline"
39
  >
40
  Learn more
41
  </a>
42
  </p>
43
  </div>
44
 
45
- <div>
 
 
 
46
  <h3 className="font-semibold text-base mb-1">
47
  Completely private & offline-capable
48
  </h3>
@@ -53,7 +59,10 @@ export default function Initialize({
53
  </p>
54
  </div>
55
 
56
- <div>
 
 
 
57
  <h3 className="font-semibold text-base mb-1">
58
  Experimental — WebGPU required
59
  </h3>
@@ -66,20 +75,25 @@ export default function Initialize({
66
 
67
  {/* Initialize button or progress indicator */}
68
  {isInitializing ? (
69
- <div className="w-full space-y-2">
 
 
 
70
  <div className="flex justify-between items-center">
71
  <span className="text-sm font-medium text-muted-foreground">
72
  Loading model...
73
  </span>
74
- <span className="text-sm font-medium text-primary">
75
  {progress}%
76
  </span>
77
  </div>
78
  <div className="w-full bg-muted rounded-full h-2 overflow-hidden">
79
  <div
80
- className="bg-primary h-full transition-all duration-300 ease-out"
81
  style={{ width: `${progress}%` }}
82
- />
 
 
83
  </div>
84
  <p className="text-xs text-muted-foreground text-center">
85
  This may take a few moments. Please don't close the page.
@@ -90,7 +104,7 @@ export default function Initialize({
90
  variant="primary"
91
  onClick={onInitialize}
92
  disabled={isInitializing}
93
- className="text-lg mt-8"
94
  >
95
  {isInitializing
96
  ? "Initializing..."
 
17
  className = "",
18
  }: InitializeProps) {
19
  return (
20
+ <div className={cn("max-w-2xl mx-auto px-8 animate-fade-in-up", className)}>
21
  <div className="bg-white rounded-lg shadow-md p-8 border border-border">
22
  <div className="flex flex-col items-center gap-6">
23
  {/* Description */}
24
  <div className="space-y-4 text-left w-full">
25
+ <div
26
+ className="animate-fade-in-up"
27
+ style={{ animationDelay: "0.1s", opacity: 0 }}
28
+ >
29
  <h3 className="font-semibold text-base mb-1">
30
  About TranslateGemma 4B
31
  </h3>
 
38
  href="https://blog.google/innovation-and-ai/technology/developers-tools/translategemma/"
39
  target="_blank"
40
  rel="noopener noreferrer"
41
+ className="text-primary hover:underline underline-offset-2 transition-all hover:underline-offset-4"
42
  >
43
  Learn more
44
  </a>
45
  </p>
46
  </div>
47
 
48
+ <div
49
+ className="animate-fade-in-up"
50
+ style={{ animationDelay: "0.2s", opacity: 0 }}
51
+ >
52
  <h3 className="font-semibold text-base mb-1">
53
  Completely private & offline-capable
54
  </h3>
 
59
  </p>
60
  </div>
61
 
62
+ <div
63
+ className="animate-fade-in-up"
64
+ style={{ animationDelay: "0.3s", opacity: 0 }}
65
+ >
66
  <h3 className="font-semibold text-base mb-1">
67
  Experimental — WebGPU required
68
  </h3>
 
75
 
76
  {/* Initialize button or progress indicator */}
77
  {isInitializing ? (
78
+ <div
79
+ className="w-full space-y-2 animate-fade-in-up"
80
+ style={{ animationDelay: "0.4s", opacity: 0 }}
81
+ >
82
  <div className="flex justify-between items-center">
83
  <span className="text-sm font-medium text-muted-foreground">
84
  Loading model...
85
  </span>
86
+ <span className="text-sm font-medium text-primary animate-pulse-soft">
87
  {progress}%
88
  </span>
89
  </div>
90
  <div className="w-full bg-muted rounded-full h-2 overflow-hidden">
91
  <div
92
+ className="bg-primary h-full transition-all duration-300 ease-out relative overflow-hidden"
93
  style={{ width: `${progress}%` }}
94
+ >
95
+ <div className="absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-[shimmer_2s_infinite]" />
96
+ </div>
97
  </div>
98
  <p className="text-xs text-muted-foreground text-center">
99
  This may take a few moments. Please don't close the page.
 
104
  variant="primary"
105
  onClick={onInitialize}
106
  disabled={isInitializing}
107
+ className="text-lg! mt-4"
108
  >
109
  {isInitializing
110
  ? "Initializing..."
src/index.css CHANGED
@@ -64,3 +64,69 @@ body {
64
  #root {
65
  min-height: 100vh;
66
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  #root {
65
  min-height: 100vh;
66
  }
67
+
68
+ /* Micro-animations */
69
+ @keyframes fadeInUp {
70
+ from {
71
+ opacity: 0;
72
+ transform: translateY(20px);
73
+ }
74
+ to {
75
+ opacity: 1;
76
+ transform: translateY(0);
77
+ }
78
+ }
79
+
80
+ @keyframes fadeIn {
81
+ from {
82
+ opacity: 0;
83
+ }
84
+ to {
85
+ opacity: 1;
86
+ }
87
+ }
88
+
89
+ @keyframes float {
90
+ 0%,
91
+ 100% {
92
+ transform: translateY(0px);
93
+ }
94
+ 50% {
95
+ transform: translateY(-5px);
96
+ }
97
+ }
98
+
99
+ @keyframes pulse-soft {
100
+ 0%,
101
+ 100% {
102
+ opacity: 1;
103
+ }
104
+ 50% {
105
+ opacity: 0.8;
106
+ }
107
+ }
108
+
109
+ @keyframes shimmer {
110
+ 0% {
111
+ background-position: -200% center;
112
+ }
113
+ 100% {
114
+ background-position: 200% center;
115
+ }
116
+ }
117
+
118
+ .animate-fade-in-up {
119
+ animation: fadeInUp 0.6s ease-out forwards;
120
+ }
121
+
122
+ .animate-fade-in {
123
+ animation: fadeIn 0.6s ease-out forwards;
124
+ }
125
+
126
+ .animate-float {
127
+ animation: float 3s ease-in-out infinite;
128
+ }
129
+
130
+ .animate-pulse-soft {
131
+ animation: pulse-soft 2s ease-in-out infinite;
132
+ }