mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
* docs(replace): replace sandpack demos with code blocks in customize-theme.en-US.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: update demo paths in theme customization docs * docs: add first example demo and update documentation * docs(demo): add Radio component to disable-motion example Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(demo): initialize timerRef with null for proper typing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
38 lines
950 B
TypeScript
38 lines
950 B
TypeScript
import React, { useEffect, useRef, useState } from 'react';
|
|
import { Checkbox, Col, ConfigProvider, Flex, Radio, Row, Switch } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [checked, setChecked] = useState<boolean>(false);
|
|
const timerRef = useRef<ReturnType<typeof setInterval>>(null);
|
|
|
|
useEffect(() => {
|
|
timerRef.current = setInterval(() => {
|
|
setChecked((prev) => !prev);
|
|
}, 500);
|
|
return () => {
|
|
if (timerRef.current) {
|
|
clearInterval(timerRef.current);
|
|
}
|
|
};
|
|
}, []);
|
|
|
|
const nodes = (
|
|
<Flex gap="small">
|
|
<Checkbox checked={checked}>Checkbox</Checkbox>
|
|
<Radio checked={checked}>Radio</Radio>
|
|
<Switch checked={checked} />
|
|
</Flex>
|
|
);
|
|
|
|
return (
|
|
<Row gutter={[24, 24]}>
|
|
<Col span={24}>{nodes}</Col>
|
|
<Col span={24}>
|
|
<ConfigProvider theme={{ token: { motion: false } }}>{nodes}</ConfigProvider>
|
|
</Col>
|
|
</Row>
|
|
);
|
|
};
|
|
|
|
export default App;
|