Merge pull request #14930 from strapi/fix/relation-multiple-wrap

CM: Fix RelationMultiple text wrapping
This commit is contained in:
Gustav Hansen 2022-11-18 17:00:59 +01:00 committed by GitHub
commit ae02eec483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 20 deletions

View File

@ -5,6 +5,7 @@ import { useIntl } from 'react-intl';
import { Typography } from '@strapi/design-system/Typography'; import { Typography } from '@strapi/design-system/Typography';
import { Box } from '@strapi/design-system/Box'; import { Box } from '@strapi/design-system/Box';
import { Badge } from '@strapi/design-system/Badge'; import { Badge } from '@strapi/design-system/Badge';
import { Flex } from '@strapi/design-system/Flex';
import { SimpleMenu, MenuItem } from '@strapi/design-system/SimpleMenu'; import { SimpleMenu, MenuItem } from '@strapi/design-system/SimpleMenu';
import { Loader } from '@strapi/design-system/Loader'; import { Loader } from '@strapi/design-system/Loader';
import styled from 'styled-components'; import styled from 'styled-components';
@ -38,8 +39,8 @@ const RelationMultiple = ({ fieldSchema, metadatas, name, entityId, value, conte
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const Label = ( const Label = (
<> <Flex gap={1} wrap="nowrap">
<Badge>{value.count}</Badge>{' '} <Badge>{value.count}</Badge>
{formatMessage( {formatMessage(
{ {
id: 'content-manager.containers.ListPage.items', id: 'content-manager.containers.ListPage.items',
@ -47,7 +48,7 @@ const RelationMultiple = ({ fieldSchema, metadatas, name, entityId, value, conte
}, },
{ number: value.count } { number: value.count }
)} )}
</> </Flex>
); );
const notify = () => { const notify = () => {

View File

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DynamicTabe / Cellcontent / RelationMultiple renders and matches the snapshot 1`] = ` exports[`DynamicTabe / Cellcontent / RelationMultiple renders and matches the snapshot 1`] = `
.c11 { .c12 {
border: 0; border: 0;
-webkit-clip: rect(0 0 0 0); -webkit-clip: rect(0 0 0 0);
clip: rect(0 0 0 0); clip: rect(0 0 0 0);
@ -13,18 +13,36 @@ exports[`DynamicTabe / Cellcontent / RelationMultiple renders and matches the sn
width: 1px; width: 1px;
} }
.c6 { .c7 {
background: #f6f6f9; background: #f6f6f9;
padding: 4px; padding: 4px;
border-radius: 4px; border-radius: 4px;
min-width: 20px; min-width: 20px;
} }
.c9 { .c10 {
padding-left: 8px; padding-left: 8px;
} }
.c7 { .c6 {
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
gap: 4px;
}
.c8 {
-webkit-align-items: center; -webkit-align-items: center;
-webkit-box-align: center; -webkit-box-align: center;
-ms-flex-align: center; -ms-flex-align: center;
@ -50,7 +68,7 @@ exports[`DynamicTabe / Cellcontent / RelationMultiple renders and matches the sn
color: #32324d; color: #32324d;
} }
.c8 { .c9 {
font-weight: 600; font-weight: 600;
font-size: 0.6875rem; font-size: 0.6875rem;
line-height: 1.45; line-height: 1.45;
@ -191,7 +209,7 @@ exports[`DynamicTabe / Cellcontent / RelationMultiple renders and matches the sn
fill: #8e8ea9; fill: #8e8ea9;
} }
.c10 { .c11 {
display: -webkit-box; display: -webkit-box;
display: -webkit-flex; display: -webkit-flex;
display: -ms-flexbox; display: -ms-flexbox;
@ -202,7 +220,7 @@ exports[`DynamicTabe / Cellcontent / RelationMultiple renders and matches the sn
align-items: center; align-items: center;
} }
.c10 svg { .c11 svg {
height: 4px; height: 4px;
width: 6px; width: 6px;
} }
@ -230,23 +248,27 @@ exports[`DynamicTabe / Cellcontent / RelationMultiple renders and matches the sn
class="c4 c5" class="c4 c5"
> >
<div <div
class="c0 c6 c7" class="c0 c6"
wrap="nowrap"
>
<div
class="c0 c7 c8"
> >
<span <span
class="c4 c8" class="c4 c9"
> >
1 1
</span> </span>
</div> </div>
item item
</div>
</span> </span>
<div <div
aria-hidden="true" aria-hidden="true"
class="c0 c9" class="c0 c10"
> >
<span <span
class="c10" class="c11"
> >
<svg <svg
aria-hidden="true" aria-hidden="true"
@ -269,7 +291,7 @@ exports[`DynamicTabe / Cellcontent / RelationMultiple renders and matches the sn
</div> </div>
</div> </div>
<div <div
class="c11" class="c12"
> >
<p <p
aria-live="polite" aria-live="polite"