@moda/om 17.13.0 → 17.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/src/components/LoadingShapes/LoadingShapes.d.ts +3 -0
- package/dist/src/components/LoadingShapes/LoadingShapes.stories.d.ts +6 -0
- package/dist/src/components/LoadingShapes/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/LoadingShapes/LoadingShapes.scss +9 -0
- package/src/components/LoadingShapes/LoadingShapes.stories.tsx +11 -0
- package/src/components/LoadingShapes/LoadingShapes.tsx +37 -0
- package/src/components/LoadingShapes/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [17.14.0](https://github.com/ModaOperandi/om/compare/v17.13.0...v17.14.0) (2022-11-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **loading-shapes:** adds the component, imported from discovery and its stories ([#3055](https://github.com/ModaOperandi/om/issues/3055)) ([c242985](https://github.com/ModaOperandi/om/commit/c242985806107cc78e550f030cf0975301067c17))
|
|
12
|
+
|
|
6
13
|
# [17.13.0](https://github.com/ModaOperandi/om/compare/v17.12.0...v17.13.0) (2022-11-14)
|
|
7
14
|
|
|
8
15
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoadingShapes';
|
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { States } from 'storybook-states';
|
|
3
|
+
import { LoadingShapes } from './LoadingShapes';
|
|
4
|
+
|
|
5
|
+
export default { title: 'Components/LoadingShapes' };
|
|
6
|
+
|
|
7
|
+
export const Default = () => (
|
|
8
|
+
<States>
|
|
9
|
+
<LoadingShapes />
|
|
10
|
+
</States>
|
|
11
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { useCursor } from 'use-cursor';
|
|
4
|
+
import { ArcWindow, Circle, Diamond, Triangle } from '../Shape';
|
|
5
|
+
import { Stack } from '../Stack';
|
|
6
|
+
|
|
7
|
+
import './LoadingShapes.scss';
|
|
8
|
+
|
|
9
|
+
const INTERVAL = 100;
|
|
10
|
+
|
|
11
|
+
export const LoadingShapes = () => {
|
|
12
|
+
const items = [Triangle, Diamond, ArcWindow, Circle];
|
|
13
|
+
const { index, handleNext } = useCursor({ max: items.length });
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const interval = setInterval(() => {
|
|
17
|
+
handleNext();
|
|
18
|
+
}, INTERVAL);
|
|
19
|
+
|
|
20
|
+
return () => clearInterval(interval);
|
|
21
|
+
}, [handleNext]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Stack className='LoadingShapes' direction='horizontal' space={2}>
|
|
25
|
+
{items.map((Item, itemIndex) => (
|
|
26
|
+
<div
|
|
27
|
+
className={classNames('LoadingShapes__item', {
|
|
28
|
+
'LoadingShapes__item--current': itemIndex !== index
|
|
29
|
+
})}
|
|
30
|
+
key={itemIndex}
|
|
31
|
+
>
|
|
32
|
+
<Item />
|
|
33
|
+
</div>
|
|
34
|
+
))}
|
|
35
|
+
</Stack>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoadingShapes';
|