Skip to content

Commit 82e32a2

Browse files
author
smeng9
committed
fix code style and make it readable
1 parent 50747af commit 82e32a2

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

examples/crm/src/companies/CompanyShow.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ const ContactsIterator = () => {
144144
<RecordContextProvider key={contact.id} value={contact}>
145145
<ListItem
146146
disablePadding
147-
{...(contact.last_seen && {
148-
secondaryAction: (
147+
secondaryAction={
148+
contact.last_seen ? (
149149
<Typography
150150
variant="body2"
151151
color="textSecondary"
@@ -155,8 +155,8 @@ const ContactsIterator = () => {
155155
{formatDistance(contact.last_seen, now)} ago{' '}
156156
<Status status={contact.status} />
157157
</Typography>
158-
),
159-
})}
158+
) : null
159+
}
160160
>
161161
<ListItemButton
162162
component={RouterLink}

examples/crm/src/contacts/ContactListContent.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export const ContactListContent = () => {
5151
<RecordContextProvider key={contact.id} value={contact}>
5252
<ListItem
5353
disablePadding
54-
{...(contact.last_seen && {
55-
secondaryAction: (
54+
secondaryAction={
55+
contact.last_seen ? (
5656
<Typography
5757
variant="body2"
5858
color="textSecondary"
@@ -69,8 +69,8 @@ export const ContactListContent = () => {
6969
)}{' '}
7070
<Status status={contact.status} />
7171
</Typography>
72-
),
73-
})}
72+
) : null
73+
}
7474
>
7575
<ListItemButton
7676
component={Link}

packages/ra-ui-materialui/src/list/SimpleList/SimpleList.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ export const SimpleList = <RecordType extends RaRecord = any>(
124124
rowSx={rowSx}
125125
rowStyle={rowStyle}
126126
resource={resource}
127-
{...((rightAvatar || rightIcon) && {
128-
secondaryAction: (
127+
secondaryAction={
128+
rightAvatar || rightIcon ? (
129129
<>
130130
{rightAvatar && (
131131
<Avatar>
@@ -144,8 +144,8 @@ export const SimpleList = <RecordType extends RaRecord = any>(
144144
</ListItemIcon>
145145
)}
146146
</>
147-
),
148-
})}
147+
) : null
148+
}
149149
>
150150
<SimpleListItemContent
151151
leftAvatar={leftAvatar}

packages/ra-ui-materialui/src/list/SimpleList/SimpleListLoading.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export const SimpleListLoading = (inProps: SimpleListLoadingProps) => {
3838
{times(nbFakeLines, key => (
3939
<ListItem
4040
key={key}
41-
{...(hasRightAvatarOrIcon && {
42-
secondaryAction: <Avatar>&nbsp;</Avatar>,
43-
})}
41+
secondaryAction={
42+
hasRightAvatarOrIcon ? <Avatar>&nbsp;</Avatar> : null
43+
}
4444
>
4545
{hasLeftAvatarOrIcon && (
4646
<ListItemAvatar>

packages/ra-ui-materialui/src/list/filter/FilterListItem.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ export const FilterListItem = memo((inProps: FilterListItemProps) => {
175175
return (
176176
<StyledListItem
177177
disablePadding
178-
{...(isSelected && {
179-
secondaryAction: (
178+
secondaryAction={
179+
isSelected ? (
180180
<IconButton
181181
size="small"
182182
onClick={event => {
@@ -186,8 +186,8 @@ export const FilterListItem = memo((inProps: FilterListItemProps) => {
186186
>
187187
<CancelIcon />
188188
</IconButton>
189-
),
190-
})}
189+
) : null
190+
}
191191
{...rest}
192192
>
193193
<ListItemButton

packages/ra-ui-materialui/src/list/filter/SavedQueryFilterListItem.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ export const SavedQueryFilterListItem = memo(
7272
className={className}
7373
sx={sx}
7474
disablePadding
75-
{...(isSelected && {
76-
secondaryAction: (
75+
secondaryAction={
76+
isSelected ? (
7777
<IconButton size="small" onClick={toggleFilter}>
7878
<CancelIcon />
7979
</IconButton>
80-
),
81-
})}
80+
) : null
81+
}
8282
>
8383
<ListItemButton
8484
onClick={toggleFilter}

0 commit comments

Comments
 (0)