Skip to content

Commit f4d7483

Browse files
committed
component
1 parent e937397 commit f4d7483

File tree

11 files changed

+46
-71
lines changed

11 files changed

+46
-71
lines changed

components/DualModeImage.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { ComponentProps } from "react";
2+
import Image from "next/image";
3+
4+
5+
type ImageProps = ComponentProps<typeof Image>;
6+
type Props = Omit<ImageProps, "src"> & {
7+
darkSrc: ImageProps["src"];
8+
lightSrc: ImageProps["src"];
9+
alt: string;
10+
}
11+
12+
const DualModeImage = ({ darkSrc, lightSrc, className, alt, ...props }: Props) => {
13+
return (
14+
<>
15+
<Image src={lightSrc} className={`dark:hidden ${className}`} alt={alt} {...props} />
16+
<Image src={darkSrc} className={`hidden dark:block ${className}`} alt={alt} {...props} />
17+
</>
18+
);
19+
};
20+
21+
export default DualModeImage;

images/ois/Graph 1 Light.png

68.3 KB
Loading

images/ois/Graph 2 Dark.png

64.5 KB
Loading

images/ois/Graph 2 Light.png

63.8 KB
Loading

images/ois/Graph_1_Dark.png

70.2 KB
Loading

images/ois/Graph_3_Dark.png

83.4 KB
Loading

images/ois/Graph_3_Light.png

80.7 KB
Loading
-32.8 KB
Loading
32.8 KB
Loading

pages/home/oracle-integrity-staking/reward-examples.mdx

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import RewardSimulator from "@/components/RewardSimulator";
2+
import DualModeImage from "../../../components/DualModeImage";
23
import Image from "next/image";
34
import OIS_Rewards_Example_Dark_1 from "../../../images/ois/OIS_Rewards_Example_Dark_1.png";
45
import OIS_Rewards_Example_Light_1 from "../../../images/ois/OIS_Rewards_Example_Light_1.png";
@@ -36,19 +37,12 @@ $$
3637
\end{aligned}
3738
$$
3839

39-
<Image
40-
src={OIS_Rewards_Example_Light_1}
40+
<DualModeImage
41+
darkSrc={OIS_Rewards_Example_Dark_1}
42+
lightSrc={OIS_Rewards_Example_Light_1}
4143
alt="Example 1"
4244
sizes="100%"
4345
placeholder="blur"
44-
className="dark:hidden"
45-
/>
46-
<Image
47-
src={OIS_Rewards_Example_Dark_1}
48-
alt="Example 1"
49-
sizes="100%"
50-
placeholder="blur"
51-
className="hidden dark:block"
5246
/>
5347

5448
## Example 2: Publisher and Delegator Stake
@@ -72,19 +66,12 @@ $$
7266
\end{aligned}
7367
$$
7468

75-
<Image
76-
src={OIS_Rewards_Example_Light_2}
77-
alt="Example 2"
78-
sizes="100%"
79-
placeholder="blur"
80-
className="dark:hidden"
81-
/>
82-
<Image
83-
src={OIS_Rewards_Example_Dark_2}
69+
<DualModeImage
70+
darkSrc={OIS_Rewards_Example_Dark_2}
71+
lightSrc={OIS_Rewards_Example_Light_2}
8472
alt="Example 2"
8573
sizes="100%"
8674
placeholder="blur"
87-
className="hidden dark:block"
8875
/>
8976

9077
## Example 3: Publisher and Delegator Stake more than the Cap
@@ -108,19 +95,12 @@ $$
10895
\end{aligned}
10996
$$
11097

111-
<Image
112-
src={OIS_Rewards_Example_Light_3}
98+
<DualModeImage
99+
darkSrc={OIS_Rewards_Example_Dark_3}
100+
lightSrc={OIS_Rewards_Example_Light_3}
113101
alt="Example 3"
114102
sizes="100%"
115103
placeholder="blur"
116-
className="dark:hidden"
117-
/>
118-
<Image
119-
src={OIS_Rewards_Example_Dark_3}
120-
alt="Example 3"
121-
sizes="100%"
122-
placeholder="blur"
123-
className="hidden dark:block"
124104
/>
125105

126106
## Example 4: Introducing Delegator Fees
@@ -148,19 +128,12 @@ $$
148128
\end{aligned}
149129
$$
150130

151-
<Image
152-
src={OIS_Rewards_Example_Light_4}
153-
alt="Example 4"
154-
sizes="100%"
155-
placeholder="blur"
156-
className="dark:hidden"
157-
/>
158-
<Image
159-
src={OIS_Rewards_Example_Dark_4}
131+
<DualModeImage
132+
darkSrc={OIS_Rewards_Example_Dark_4}
133+
lightSrc={OIS_Rewards_Example_Light_4}
160134
alt="Example 4"
161135
sizes="100%"
162136
placeholder="blur"
163-
className="hidden dark:block"
164137
/>
165138

166139
In the example, the delegator pays a 2\% fee on their rewards to the publisher. This fee is deducted from the delegator's reward and added to the publisher's reward.

0 commit comments

Comments
 (0)