-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
98 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,89 @@ | ||
.Loader { | ||
--backgroundColor: | ||
var( | ||
--loaderBackgroundColor, | ||
var(--color-control-bg-primary) | ||
); | ||
display: inline-flex; | ||
padding: calc(var(--loader-size) * 0.25); | ||
gap: var(--loader-gap); | ||
|
||
&-Dot { | ||
width: var(--loader-size); | ||
height: var(--loader-size); | ||
background: var(--backgroundColor); | ||
border-radius: 50%; | ||
animation: var(--loader-dot-animation); | ||
|
||
&_side { | ||
&_left { | ||
--loader-dot-animation: loader 1s ease infinite; | ||
} | ||
|
||
&_center { | ||
--loader-dot-animation: loader 1s -0.18s ease infinite; | ||
} | ||
--loader-color: var(--loaderBackgroundColor, var(--color-control-bg-primary)); | ||
|
||
&_right { | ||
--loader-dot-animation: loader 1s -0.36s ease infinite; | ||
} | ||
} | ||
} | ||
/* major: убрать --loader-color-finally, оставить --loader-color-prop для определения своего цвета */ | ||
--loader-color-finally: var(--loader-color-prop, var(--loader-color)); | ||
display: inline-flex; | ||
|
||
&_size { | ||
&_xs { | ||
--loader-size: var(--space-2xs); | ||
--loader-gap: var(--space-3xs); | ||
--loader-circle-size: var(--space-s); | ||
--loader-dot-size: var(--space-2xs); | ||
--loader-dot-gap: var(--space-3xs); | ||
} | ||
|
||
&_s { | ||
--loader-size: var(--space-2xs); | ||
--loader-gap: var(--space-2xs); | ||
--loader-circle-size: var(--space-m); | ||
--loader-dot-size: var(--space-2xs); | ||
--loader-dot-gap: var(--space-2xs); | ||
} | ||
|
||
&_m { | ||
--loader-size: var(--space-xs); | ||
--loader-gap: calc(var(--space-xs) - var(--space-3xs)); | ||
--loader-circle-size: var(--space-xl); | ||
--loader-dot-size: var(--space-xs); | ||
--loader-dot-gap: calc(var(--space-xs) - var(--space-3xs)); | ||
} | ||
} | ||
|
||
&_type { | ||
&_dots { | ||
padding: calc(var(--loader-dot-size) * 0.25); | ||
gap: var(--loader-dot-gap); | ||
|
||
&::before, | ||
&::after, | ||
.Loader-Dot { | ||
width: var(--loader-dot-size); | ||
height: var(--loader-dot-size); | ||
background: var(--loader-color-finally); | ||
border-radius: 50%; | ||
animation: | ||
Loader_Animate_type_dots 1s var(--loader-dot-animation-delay) | ||
ease infinite; | ||
} | ||
|
||
&::before, | ||
&::after { | ||
content: ''; | ||
} | ||
|
||
&::before { | ||
--loader-dot-animation-delay: 0s; | ||
} | ||
|
||
&::after { | ||
--loader-dot-animation-delay: 0.36s; | ||
} | ||
|
||
.Loader-Dot { | ||
--loader-dot-animation-delay: 0.18s; | ||
} | ||
} | ||
|
||
&_circle { | ||
--loader-circle-mask: | ||
conic-gradient(#0000 2%, #000), | ||
linear-gradient(#000 0 0) content-box; | ||
width: var(--loader-circle-size); | ||
height: var(--loader-circle-size); | ||
padding: 2px; | ||
background: var(--loader-color-finally); | ||
border-radius: 50%; | ||
animation: Loader_Animate_type_circle 1.2s infinite linear; | ||
mask: var(--loader-circle-mask); | ||
mask-composite: subtract; | ||
} | ||
} | ||
} | ||
|
||
@keyframes loader { | ||
@keyframes Loader_Animate_type_dots { | ||
50% { | ||
transform: scale(1.5); | ||
} | ||
} | ||
|
||
@keyframes Loader_Animate_type_circle { | ||
to { | ||
transform: rotate(1turn); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { PropsWithHTMLAttributes } from '../../utils/types/PropsWithHTMLAttributes'; | ||
|
||
export const loaderPropSize = ['m', 's', 'xs'] as const; | ||
export const loaderPropSize = ['xs', 's', 'm'] as const; | ||
export type LoaderPropSize = typeof loaderPropSize[number]; | ||
export const loaderPropSizeDefault: LoaderPropSize = loaderPropSize[0]; | ||
|
||
type Props = { | ||
size?: LoaderPropSize; | ||
children?: never; | ||
type?: 'dots' | 'circle'; | ||
view?: 'primary' | 'clear'; | ||
}; | ||
|
||
export type LoaderProps = PropsWithHTMLAttributes<Props, HTMLDivElement>; |