@cloudwick/astral-ui-cli 0.1.1 → 0.2.1
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.
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { ReactElement } from "react";
|
|
2
2
|
|
|
3
|
-
type
|
|
3
|
+
type TVariant = "lorem" | "space" | "startrek";
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface IPlaceholderTextProps {
|
|
6
6
|
paragraphs?: number;
|
|
7
7
|
sentences?: number;
|
|
8
|
-
variant?:
|
|
8
|
+
variant?: TVariant;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const getRandomSentences = (
|
|
@@ -25,7 +25,7 @@ const getRandomSentences = (
|
|
|
25
25
|
return result.join( " " ).replace( /\s+/g, " " ).trim();
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export const placeholderText = ( sentences:number, variant:
|
|
28
|
+
export const placeholderText = ( sentences:number, variant: TVariant = "lorem" as TVariant ): string => {
|
|
29
29
|
const wordCollection = variants?.[variant] ?? variants.lorem;
|
|
30
30
|
const paragraph = getRandomSentences( wordCollection, sentences );
|
|
31
31
|
return paragraph;
|
|
@@ -35,7 +35,7 @@ export const PlaceholderText = ({
|
|
|
35
35
|
paragraphs = 2,
|
|
36
36
|
sentences = 4,
|
|
37
37
|
variant = "lorem"
|
|
38
|
-
}:
|
|
38
|
+
}: IPlaceholderTextProps ): ReactElement => {
|
|
39
39
|
let text = "";
|
|
40
40
|
for ( let i = 0; i < paragraphs; i++ ){
|
|
41
41
|
const paragraph = `<p>${placeholderText( sentences, variant )}</p>`;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
2
|
|
|
3
|
-
type
|
|
3
|
+
type TReturnType = {
|
|
4
4
|
width: number;
|
|
5
5
|
height: number;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
export function useWindowSize():
|
|
8
|
+
export function useWindowSize(): TReturnType {
|
|
9
9
|
const [ windowSize, setWindowSize ] = useState<{
|
|
10
10
|
width: number | undefined;
|
|
11
11
|
height: number | undefined;
|
|
@@ -29,5 +29,5 @@ export function useWindowSize(): ReturnType {
|
|
|
29
29
|
// Remove event listener on cleanup
|
|
30
30
|
return () => window.removeEventListener( "resize", handleResize );
|
|
31
31
|
}, []); // Empty array ensures that effect is only run on mount
|
|
32
|
-
return windowSize as
|
|
32
|
+
return windowSize as TReturnType;
|
|
33
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudwick/astral-ui-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "CLI for installing Astral UI components in any codebase",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -62,4 +62,4 @@
|
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=18.0.0"
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|