ant-design/components/progress/demo/circle-dynamic.md
lijianan 4ca2ed63bd
feat: V5 Responsive Circle Progress (#38231)
* feat: V5 Responsive Circle Progress

* fix: add useMemo

* Update components/progress/demo/circle-micro.md

Co-authored-by: MadCcc <1075746765@qq.com>

* Update components/progress/demo/circle-micro.md

Co-authored-by: MadCcc <1075746765@qq.com>

* Update components/progress/demo/circle-micro.md

Co-authored-by: MadCcc <1075746765@qq.com>

* Update components/progress/progress.tsx

Co-authored-by: MadCcc <1075746765@qq.com>

* fix: raname processInfo

* fix: add dep list

* fix: add demo

* fix: fix width

* fix: fix width

* fix: fix snap

* fix: rename

* fix: snap

* Update components/progress/Circle.tsx

Co-authored-by: MadCcc <1075746765@qq.com>

* fix: rename

* fix: fix style

* fix: update demo

* fix: fix style

* fix: fix ci

* fix: fix style

* fix: del verticalAlign

* fix: fix

* fix: fix cicd

* fix: update demo

* fix: update demo

* fix: fix style

* fix: fix style

Co-authored-by: MadCcc <1075746765@qq.com>
2022-10-31 10:23:26 +08:00

1.0 KiB

order title
4
zh-CN en-US
进度圈动态展示 Dynamic circular progress bar

zh-CN

会动的进度条才是好进度条。

en-US

A dynamic progress bar is better.

import { MinusOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, Progress } from 'antd';
import React, { useState } from 'react';

const App: React.FC = () => {
  const [percent, setPercent] = useState(0);

  const increase = () => {
    let newPercent = percent + 10;
    if (newPercent > 100) {
      newPercent = 100;
    }
    setPercent(newPercent);
  };

  const decline = () => {
    let newPercent = percent - 10;
    if (newPercent < 0) {
      newPercent = 0;
    }
    setPercent(newPercent);
  };

  return (
    <>
      <Progress type="circle" percent={percent} style={{ marginRight: 8 }} />
      <Button.Group>
        <Button onClick={decline} icon={<MinusOutlined />} />
        <Button onClick={increase} icon={<PlusOutlined />} />
      </Button.Group>
    </>
  );
};

export default App;