Skip to content

Commit

Permalink
Revert "demo: update Grid、Table、Select demo (#47709)"
Browse files Browse the repository at this point in the history
This reverts commit c01c1b5.
  • Loading branch information
MadCcc committed Mar 6, 2024
1 parent 0aa8371 commit 33ce7fb
Show file tree
Hide file tree
Showing 11 changed files with 149 additions and 233 deletions.
10 changes: 4 additions & 6 deletions components/grid/__tests__/__snapshots__/demo-extend.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1500,16 +1500,14 @@ exports[`renders components/grid/demo/sort.tsx extend context correctly 1`] = `
exports[`renders components/grid/demo/sort.tsx extend context correctly 2`] = `[]`;

exports[`renders components/grid/demo/useBreakpoint.tsx extend context correctly 1`] = `
<div
class="ant-flex ant-flex-wrap-wrap ant-flex-gap-small"
>
Current break point:
Array [
Current break point: ,
<span
class="ant-tag ant-tag-blue"
>
xs
</span>
</div>
</span>,
]
`;

exports[`renders components/grid/demo/useBreakpoint.tsx extend context correctly 2`] = `[]`;
10 changes: 5 additions & 5 deletions components/grid/__tests__/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1419,9 +1419,9 @@ exports[`renders components/grid/demo/sort.tsx correctly 1`] = `
`;

exports[`renders components/grid/demo/useBreakpoint.tsx correctly 1`] = `
<div
class="ant-flex ant-flex-wrap-wrap ant-flex-gap-small"
>
Current break point:
</div>
Array [
Current break point:,
<!-- -->,
,
]
`;
11 changes: 6 additions & 5 deletions components/grid/demo/useBreakpoint.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import React from 'react';
import { Flex, Grid, Tag } from 'antd';
import { Grid, Tag } from 'antd';

const { useBreakpoint } = Grid;

const App: React.FC = () => {
const screens = useBreakpoint();

return (
<Flex wrap="wrap" gap="small">
Current break point:
<>
Current break point:{' '}
{Object.entries(screens)
.filter((screen) => !!screen[1])
.map<React.ReactNode>((screen) => (
.map((screen) => (
<Tag color="blue" key={screen[0]}>
{screen[0]}
</Tag>
))}
</Flex>
</>
);
};

Expand Down
32 changes: 12 additions & 20 deletions components/select/__tests__/__snapshots__/demo-extend.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1522,11 +1522,9 @@ exports[`renders components/select/demo/custom-tag-render.tsx extend context cor
<span>
<span
class="ant-tag ant-tag-gold"
style="margin-inline-end: 4px;"
style="margin-right: 3px;"
>
<span>
gold
</span>
gold
<span
aria-label="close"
class="anticon anticon-close ant-tag-close-icon"
Expand Down Expand Up @@ -1558,11 +1556,9 @@ exports[`renders components/select/demo/custom-tag-render.tsx extend context cor
<span>
<span
class="ant-tag ant-tag-cyan"
style="margin-inline-end: 4px;"
style="margin-right: 3px;"
>
<span>
cyan
</span>
cyan
<span
aria-label="close"
class="anticon anticon-close ant-tag-close-icon"
Expand Down Expand Up @@ -1661,13 +1657,12 @@ exports[`renders components/select/demo/custom-tag-render.tsx extend context cor
<div
aria-selected="true"
class="ant-select-item ant-select-item-option ant-select-item-option-active ant-select-item-option-selected"
title="gold"
>
<div
class="ant-select-item-option-content"
>
<span>
gold
</span>
gold
</div>
<span
aria-hidden="true"
Expand Down Expand Up @@ -1699,37 +1694,34 @@ exports[`renders components/select/demo/custom-tag-render.tsx extend context cor
<div
aria-selected="false"
class="ant-select-item ant-select-item-option"
title="lime"
>
<div
class="ant-select-item-option-content"
>
<span>
lime
</span>
lime
</div>
</div>
<div
aria-selected="false"
class="ant-select-item ant-select-item-option"
title="green"
>
<div
class="ant-select-item-option-content"
>
<span>
green
</span>
green
</div>
</div>
<div
aria-selected="true"
class="ant-select-item ant-select-item-option ant-select-item-option-selected"
title="cyan"
>
<div
class="ant-select-item-option-content"
>
<span>
cyan
</span>
cyan
</div>
<span
aria-hidden="true"
Expand Down
12 changes: 4 additions & 8 deletions components/select/__tests__/__snapshots__/demo.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -718,11 +718,9 @@ exports[`renders components/select/demo/custom-tag-render.tsx correctly 1`] = `
<span>
<span
class="ant-tag ant-tag-gold"
style="margin-inline-end:4px"
style="margin-right:3px"
>
<span>
gold
</span>
gold
<span
aria-label="close"
class="anticon anticon-close ant-tag-close-icon"
Expand Down Expand Up @@ -754,11 +752,9 @@ exports[`renders components/select/demo/custom-tag-render.tsx correctly 1`] = `
<span>
<span
class="ant-tag ant-tag-cyan"
style="margin-inline-end:4px"
style="margin-right:3px"
>
<span>
cyan
</span>
cyan
<span
aria-label="close"
class="anticon anticon-close ant-tag-close-icon"
Expand Down
9 changes: 2 additions & 7 deletions components/select/demo/custom-tag-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import type { SelectProps } from 'antd';

type TagRender = SelectProps['tagRender'];

const options: SelectProps['options'] = [
{ value: 'gold', label: <span>gold</span> },
{ value: 'lime', label: <span>lime</span> },
{ value: 'green', label: <span>green</span> },
{ value: 'cyan', label: <span>cyan</span> },
];
const options = [{ value: 'gold' }, { value: 'lime' }, { value: 'green' }, { value: 'cyan' }];

const tagRender: TagRender = (props) => {
const { label, value, closable, onClose } = props;
Expand All @@ -23,7 +18,7 @@ const tagRender: TagRender = (props) => {
onMouseDown={onPreventMouseDown}
closable={closable}
onClose={onClose}
style={{ marginInlineEnd: 4 }}
style={{ marginRight: 3 }}
>
{label}
</Tag>
Expand Down

0 comments on commit 33ce7fb

Please sign in to comment.