Skip to content

Commit

Permalink
add inline loader
Browse files Browse the repository at this point in the history
  • Loading branch information
kishkoigor committed Mar 26, 2024
1 parent 8b20216 commit e75dd33
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/components/InlineLoader/InlineLoader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { InlineLoaderProps } from './InlineLoader.types';
import s from './inline-loader.module.css';

export function InlineLoader({ className }: InlineLoaderProps) {
return (
<div className={`${s.loader} ${className}`}>
<div />
<div />
<div />
<div />
</div>
);
}
3 changes: 3 additions & 0 deletions src/components/InlineLoader/InlineLoader.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface InlineLoaderProps {
className?: string;
}
1 change: 1 addition & 0 deletions src/components/InlineLoader/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './InlineLoader';
63 changes: 63 additions & 0 deletions src/components/InlineLoader/inline-loader.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.loader {
display: inline-block;
position: relative;
width: 40px;
height: 6px;
}

.loader div {
position: absolute;
top: 0;
width: 6px;
height: 6px;
border-radius: 50%;
background: #457eff;
animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loader div:nth-child(1) {
left: 4px;
animation: inline-loader1 0.6s infinite;
}

.loader div:nth-child(2) {
left: 4px;
animation: inline-loader2 0.6s infinite;
}

.loader div:nth-child(3) {
left: 16px;
animation: inline-loader2 0.6s infinite;
}

.loader div:nth-child(4) {
left: 28px;
animation: inline-loader3 0.6s infinite;
}

@keyframes inline-loader1 {
0% {
transform: scale(0);
}
100% {
transform: scale(1);
}
}

@keyframes inline-loader3 {
0% {
transform: scale(1);
}
100% {
transform: scale(0);
}
}

@keyframes inline-loader2 {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(12px, 0);
}
}
2 changes: 1 addition & 1 deletion src/components/Notification/Notify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const notifyLoading = (
options?: ToastOptions,
) => {
toast(<Content message={message} description={description} />, {
icon: Spinner,
icon: <Spinner />,
className: `${s.border} ${s.toast}`,
...options,
});
Expand Down
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ export * from './ConnectWallet';
export * from './Badge';
export * from './Radio';
export * from './Checkbox';
export * from './InlineLoader';

0 comments on commit e75dd33

Please sign in to comment.