@yourdash/uikit 0.1.11 → 0.1.13
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.
@@ -8,6 +8,7 @@ import styles from "./image.module.scss";
|
|
8
8
|
import React, { FC, useEffect, useRef, useState } from "react";
|
9
9
|
import clippy from "../../core/clippy.ts";
|
10
10
|
import UKIcon from "../icon/UKIcon.tsx";
|
11
|
+
import { useLevel, useLevelClass } from "../../core/level.tsx";
|
11
12
|
|
12
13
|
const UKImage: FC<{
|
13
14
|
src: string;
|
@@ -20,8 +21,10 @@ const UKImage: FC<{
|
|
20
21
|
height?: number;
|
21
22
|
style?: React.CSSProperties;
|
22
23
|
onClick?: () => void;
|
24
|
+
|
23
25
|
}> = (props) => {
|
24
26
|
const ref = useRef<HTMLDivElement>(null);
|
27
|
+
const level= useLevel()
|
25
28
|
const [src, setSrc] = useState<string>(props.src);
|
26
29
|
const [loaded, setLoaded] = useState<boolean>(false);
|
27
30
|
const [hasFailed, setHasFailed] = useState<boolean>(false);
|
@@ -67,7 +70,7 @@ const UKImage: FC<{
|
|
67
70
|
>
|
68
71
|
{!hasFailed ? (
|
69
72
|
<img
|
70
|
-
className={clippy(styles.component, props.className, loaded && styles.loaded, props.noRounding && styles.noRounding)}
|
73
|
+
className={clippy(styles.component, useLevelClass(level), props.className, loaded && styles.loaded, props.noRounding && styles.noRounding)}
|
71
74
|
draggable={false}
|
72
75
|
width={props.width}
|
73
76
|
height={props.height}
|
@@ -10,7 +10,7 @@
|
|
10
10
|
}
|
11
11
|
|
12
12
|
.component {
|
13
|
-
border-radius:
|
13
|
+
border-radius: $UKRadius;
|
14
14
|
opacity: 0;
|
15
15
|
width: 100%;
|
16
16
|
height: 100%;
|
@@ -28,7 +28,7 @@
|
|
28
28
|
}
|
29
29
|
|
30
30
|
.loaded {
|
31
|
-
transition: opacity
|
31
|
+
transition: opacity 250ms ease-out;
|
32
32
|
opacity: 1;
|
33
33
|
}
|
34
34
|
|
@@ -7,7 +7,9 @@ import LevelContext, { useLevel } from "./level.tsx";
|
|
7
7
|
import { FC } from "react";
|
8
8
|
|
9
9
|
const DecrementLevel: FC<{ children: React.ReactNode | React.ReactNode[] }> = (props) => {
|
10
|
-
|
10
|
+
const level = useLevel()
|
11
|
+
|
12
|
+
return <LevelContext.Provider value={level - 1}>{props.children}</LevelContext.Provider>;
|
11
13
|
};
|
12
14
|
|
13
15
|
export default DecrementLevel;
|
@@ -7,7 +7,9 @@ import LevelContext, { useLevel } from "./level.tsx";
|
|
7
7
|
import { FC } from "react";
|
8
8
|
|
9
9
|
const IncrementLevel: FC<{ children: React.ReactNode | React.ReactNode[] }> = (props) => {
|
10
|
-
|
10
|
+
const level = useLevel()
|
11
|
+
|
12
|
+
return <LevelContext.Provider value={level + 1}>{props.children}</LevelContext.Provider>;
|
11
13
|
};
|
12
14
|
|
13
15
|
export default IncrementLevel;
|