Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sibling Tags should have margin #47736

Merged
merged 9 commits into from Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions components/grid/__tests__/__snapshots__/demo-extend.test.ts.snap
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
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
@@ -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
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
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
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 }}
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
>
{label}
</Tag>
Expand Down