9 |
--------------------------------------------------------------------------------
/docs/demo/getScrollBarSize.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: getScrollBarSize
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/portal.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: portal
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/styleChecker.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: styleChecker
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/toArray.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: toArray
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/examples/dynaymicCSS.tsx:
--------------------------------------------------------------------------------
1 | import type { Prepend } from 'rc-util/es/Dom/dynamicCSS';
2 | import { removeCSS, updateCSS } from 'rc-util/es/Dom/dynamicCSS';
3 | import React from 'react';
4 |
5 | function injectStyle(id: number, prepend?: Prepend, priority?: number) {
6 | const randomColor = Math.floor(Math.random() * 16777215).toString(16);
7 |
8 | updateCSS(`body { background: #${randomColor} }`, `style-${id}`, {
9 | prepend,
10 | priority,
11 | });
12 | }
13 |
14 | export default () => {
15 | const [id, setId] = React.useState(0);
16 | const idRef = React.useRef(id);
17 | idRef.current = id;
18 |
19 | // Clean up
20 | React.useEffect(() => {
21 | return () => {
22 | for (let i = 0; i <= idRef.current; i += 1) {
23 | removeCSS(`style-${i}`);
24 | }
25 | };
26 | }, []);
27 |
28 | return (
29 | <>
30 |
38 |
39 |
47 |
48 |
55 | >
56 | );
57 | };
58 |
--------------------------------------------------------------------------------
/docs/examples/getScrollBarSize.tsx:
--------------------------------------------------------------------------------
1 | import getScrollBarSize, {
2 | getTargetScrollBarSize,
3 | } from 'rc-util/es/getScrollBarSize';
4 | import React from 'react';
5 |
6 | const cssText = `
7 | #customizeContainer::-webkit-scrollbar {
8 | width: 2em;
9 | height: 23px;
10 | background: blue;
11 | }
12 |
13 | #customizeContainer::-webkit-scrollbar-thumb {
14 | background: red;
15 | height: 30px;
16 | }
17 |
18 | #scrollContainer {
19 | scrollbar-color: red orange;
20 | scrollbar-width: thin;
21 | }
22 | `;
23 |
24 | export default () => {
25 | const defaultRef = React.useRef{sizeData}87 |
Press F12 to open the console (Click Clear Console)
50 | 51 |1
58 |1
64 | 2 65 |