Skip to content

Commit

Permalink
feat: Loading animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Hernández Alcojor committed Jul 11, 2024
1 parent 7191e65 commit 3054c01
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions public/plane.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/pages/admin/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.loading {
animation: loading-plane 5s infinite;
}

@keyframes loading-plane {
from {
transform: translateX(0);
}

to {
transform: translateX(calc(1200px - 1em));
}
}
4 changes: 3 additions & 1 deletion src/pages/admin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { FormEvent, useEffect, useState } from 'react';
import { useLocalStorage } from 'usehooks-ts';
import { LocalStorageImgUrls, Profile } from '@/types';
import { addUrl } from '@/utils';
import styles from './index.module.css';

function getPrompt(profileKey: Profile, destination: string): string {
const profile = PROFILES[profileKey];
Expand Down Expand Up @@ -110,8 +111,9 @@ const AdminPage = () => {
</form>
<div className="mt-4">
{loading && (
<div className="text-center">
<div className="text-center loading-image">
<p>Generando imagen...</p>
<img className={styles.loading} src="/plane.svg" alt="Avión" />
</div>
)}
{generatedImgUrl && (
Expand Down

0 comments on commit 3054c01

Please sign in to comment.