Skip to content

Commit

Permalink
docs: update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jia-nan committed Nov 25, 2022
1 parent 10058e6 commit 4ae1870
Show file tree
Hide file tree
Showing 10 changed files with 1,965 additions and 1,764 deletions.
1,836 changes: 967 additions & 869 deletions components/progress/__tests__/__snapshots__/demo-extend.test.ts.snap

Large diffs are not rendered by default.

1,816 changes: 957 additions & 859 deletions components/progress/__tests__/__snapshots__/demo.test.ts.snap

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components/progress/demo/circle-mini.tsx
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Progress, Space } from 'antd';

const App: React.FC = () => (
<Space>
<Space wrap>
<Progress type="circle" percent={30} width={80} />
<Progress type="circle" percent={70} width={80} status="exception" />
<Progress type="circle" percent={100} width={80} />
Expand Down
2 changes: 1 addition & 1 deletion components/progress/demo/circle.tsx
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Progress, Space } from 'antd';

const App: React.FC = () => (
<Space>
<Space wrap>
<Progress type="circle" percent={75} />
<Progress type="circle" percent={70} status="exception" />
<Progress type="circle" percent={100} />
Expand Down
8 changes: 4 additions & 4 deletions components/progress/demo/dashboard.tsx
@@ -1,11 +1,11 @@
import React from 'react';
import { Progress } from 'antd';
import { Progress, Space } from 'antd';

const App: React.FC = () => (
<>
<Progress type="dashboard" percent={75} style={{ marginRight: 8 }} />
<Space wrap>
<Progress type="dashboard" percent={75} />
<Progress type="dashboard" percent={75} gapDegree={30} />
</>
</Space>
);

export default App;
26 changes: 15 additions & 11 deletions components/progress/demo/dynamic.tsx
Expand Up @@ -3,22 +3,26 @@ import { MinusOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, Progress } from 'antd';

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

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

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

return (
Expand Down
2 changes: 1 addition & 1 deletion components/progress/demo/format.tsx
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Progress, Space } from 'antd';

const App: React.FC = () => (
<Space>
<Space wrap>
<Progress type="circle" percent={75} format={(percent) => `${percent} Days`} />
<Progress type="circle" percent={100} format={() => 'Done'} />
</Space>
Expand Down
13 changes: 5 additions & 8 deletions components/progress/demo/gradient-line.tsx
@@ -1,17 +1,14 @@
import React from 'react';
import { Progress } from 'antd';
import { Progress, Space } from 'antd';

const App: React.FC = () => (
<>
<Progress percent={99.9} strokeColor={{ '0%': '#108ee9', '100%': '#87d068' }} />
<Progress percent={99.9} status="active" strokeColor={{ from: '#108ee9', to: '#87d068' }} />
<Progress type="circle" percent={90} strokeColor={{ '0%': '#108ee9', '100%': '#87d068' }} />
<Progress
type="circle"
percent={100}
style={{ marginLeft: 8 }}
strokeColor={{ '0%': '#108ee9', '100%': '#87d068' }}
/>
<Space wrap>
<Progress type="circle" percent={90} strokeColor={{ '0%': '#108ee9', '100%': '#87d068' }} />
<Progress type="circle" percent={100} strokeColor={{ '0%': '#108ee9', '100%': '#87d068' }} />
</Space>
</>
);

Expand Down
8 changes: 5 additions & 3 deletions components/progress/demo/linecap.tsx
@@ -1,11 +1,13 @@
import React from 'react';
import { Progress } from 'antd';
import { Progress, Space } from 'antd';

const App: React.FC = () => (
<>
<Progress strokeLinecap="butt" percent={75} />
<Progress strokeLinecap="butt" type="circle" percent={75} />
<Progress strokeLinecap="butt" type="dashboard" percent={75} style={{ marginLeft: 8 }} />
<Space wrap>
<Progress strokeLinecap="butt" type="circle" percent={75} />
<Progress strokeLinecap="butt" type="dashboard" percent={75} />
</Space>
</>
);

Expand Down
16 changes: 9 additions & 7 deletions components/progress/demo/segment.tsx
@@ -1,17 +1,19 @@
import React from 'react';
import { Progress, Tooltip } from 'antd';
import { Progress, Tooltip, Space } from 'antd';

const App: React.FC = () => (
<>
<Tooltip title="3 done / 3 in progress / 4 to do">
<Progress percent={60} success={{ percent: 30 }} />
</Tooltip>
<Tooltip title="3 done / 3 in progress / 4 to do">
<Progress percent={60} success={{ percent: 30 }} type="circle" />
</Tooltip>
<Tooltip title="3 done / 3 in progress / 4 to do">
<Progress percent={60} success={{ percent: 30 }} type="dashboard" style={{ marginLeft: 8 }} />
</Tooltip>
<Space wrap>
<Tooltip title="3 done / 3 in progress / 4 to do">
<Progress percent={60} success={{ percent: 30 }} type="circle" />
</Tooltip>
<Tooltip title="3 done / 3 in progress / 4 to do">
<Progress percent={60} success={{ percent: 30 }} type="dashboard" />
</Tooltip>
</Space>
</>
);

Expand Down

0 comments on commit 4ae1870

Please sign in to comment.