Skip to content

Commit b783dd1

Browse files
committed
fix other redundant fragements
1 parent e83afd1 commit b783dd1

File tree

85 files changed

+2435
-2695
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2435
-2695
lines changed

static/app/components/actions/confirmableAction.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ export default function ConfirmableAction({shouldConfirm, children, ...props}: P
1414
return <Confirm {...props}>{children as ConfirmProps['children']}</Confirm>;
1515
}
1616

17-
return children;
17+
return children as React.ReactNode;
1818
}

static/app/components/arithmeticBuilder/token/freeText.tsx

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type {ChangeEvent, FocusEvent, MouseEvent, RefObject} from 'react';
2-
import {Fragment, useCallback, useMemo, useRef, useState} from 'react';
2+
import {useCallback, useMemo, useRef, useState} from 'react';
33
import styled from '@emotion/styled';
44
import {Item, Section} from '@react-stately/collections';
55
import type {ListState} from '@react-stately/list';
@@ -288,50 +288,48 @@ function InternalInput({
288288
}, []);
289289

290290
return (
291-
<Fragment>
292-
<ComboBox
293-
ref={inputRef}
294-
items={items}
295-
placeholder={showPlaceholder ? t('Enter equation') : ''}
296-
inputLabel={t('Add a term')}
297-
inputValue={inputValue}
298-
filterValue={filterValue}
299-
tabIndex={item.key === state.selectionManager.focusedKey ? 0 : -1}
300-
shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}
301-
onClick={onClick}
302-
onInputBlur={onInputBlur}
303-
onInputChange={onInputChange}
304-
onInputCommit={onInputCommit}
305-
onInputEscape={onInputEscape}
306-
onInputFocus={onInputFocus}
307-
onKeyDown={onKeyDown}
308-
onKeyDownCapture={onKeyDownCapture}
309-
onOpenChange={setIsOpen}
310-
onOptionSelected={onOptionSelected}
311-
onPaste={onPaste}
312-
data-test-id={
313-
state.collection.getLastKey() === item.key
314-
? 'arithmetic-builder-input'
315-
: undefined
316-
}
317-
>
318-
{keyItem =>
319-
itemIsSection(keyItem) ? (
320-
<Section title={keyItem.label} key={keyItem.key}>
321-
{keyItem.options.map(child => (
322-
<Item {...child} key={child.key}>
323-
{child.label}
324-
</Item>
325-
))}
326-
</Section>
327-
) : (
328-
<Item {...keyItem} key={keyItem.key}>
329-
{keyItem.label}
330-
</Item>
331-
)
332-
}
333-
</ComboBox>
334-
</Fragment>
291+
<ComboBox
292+
ref={inputRef}
293+
items={items}
294+
placeholder={showPlaceholder ? t('Enter equation') : ''}
295+
inputLabel={t('Add a term')}
296+
inputValue={inputValue}
297+
filterValue={filterValue}
298+
tabIndex={item.key === state.selectionManager.focusedKey ? 0 : -1}
299+
shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}
300+
onClick={onClick}
301+
onInputBlur={onInputBlur}
302+
onInputChange={onInputChange}
303+
onInputCommit={onInputCommit}
304+
onInputEscape={onInputEscape}
305+
onInputFocus={onInputFocus}
306+
onKeyDown={onKeyDown}
307+
onKeyDownCapture={onKeyDownCapture}
308+
onOpenChange={setIsOpen}
309+
onOptionSelected={onOptionSelected}
310+
onPaste={onPaste}
311+
data-test-id={
312+
state.collection.getLastKey() === item.key
313+
? 'arithmetic-builder-input'
314+
: undefined
315+
}
316+
>
317+
{keyItem =>
318+
itemIsSection(keyItem) ? (
319+
<Section title={keyItem.label} key={keyItem.key}>
320+
{keyItem.options.map(child => (
321+
<Item {...child} key={child.key}>
322+
{child.label}
323+
</Item>
324+
))}
325+
</Section>
326+
) : (
327+
<Item {...keyItem} key={keyItem.key}>
328+
{keyItem.label}
329+
</Item>
330+
)
331+
}
332+
</ComboBox>
335333
);
336334
}
337335

static/app/components/arithmeticBuilder/token/function.tsx

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type {ChangeEvent, FocusEvent, RefObject} from 'react';
2-
import {Fragment, useCallback, useMemo, useRef, useState} from 'react';
2+
import {useCallback, useMemo, useRef, useState} from 'react';
33
import {css} from '@emotion/react';
44
import styled from '@emotion/styled';
55
import {Item, Section} from '@react-stately/collections';
@@ -243,50 +243,48 @@ function InternalInput({token, item, state, attribute, rowRef}: InternalInputPro
243243
}, []);
244244

245245
return (
246-
<Fragment>
247-
<ComboBox
248-
ref={inputRef}
249-
items={items}
250-
placeholder={attribute.attribute}
251-
inputLabel={t('Select an attribute')}
252-
inputValue={inputValue}
253-
filterValue={filterValue}
254-
tabIndex={item.key === state.selectionManager.focusedKey ? 0 : -1}
255-
shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}
256-
onClick={onClick}
257-
onInputBlur={onInputBlur}
258-
onInputChange={onInputChange}
259-
onInputCommit={onInputCommit}
260-
onInputEscape={onInputEscape}
261-
onInputFocus={onInputFocus}
262-
onKeyDown={onKeyDown}
263-
onKeyDownCapture={onKeyDownCapture}
264-
onOpenChange={setIsOpen}
265-
onOptionSelected={onOptionSelected}
266-
onPaste={onPaste}
267-
data-test-id={
268-
state.collection.getLastKey() === item.key
269-
? 'arithmetic-builder-argument-input'
270-
: undefined
271-
}
272-
>
273-
{keyItem =>
274-
itemIsSection(keyItem) ? (
275-
<Section title={keyItem.label} key={keyItem.key}>
276-
{keyItem.options.map(child => (
277-
<Item {...child} key={child.key}>
278-
{child.label}
279-
</Item>
280-
))}
281-
</Section>
282-
) : (
283-
<Item {...keyItem} key={keyItem.key}>
284-
{keyItem.label}
285-
</Item>
286-
)
287-
}
288-
</ComboBox>
289-
</Fragment>
246+
<ComboBox
247+
ref={inputRef}
248+
items={items}
249+
placeholder={attribute.attribute}
250+
inputLabel={t('Select an attribute')}
251+
inputValue={inputValue}
252+
filterValue={filterValue}
253+
tabIndex={item.key === state.selectionManager.focusedKey ? 0 : -1}
254+
shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}
255+
onClick={onClick}
256+
onInputBlur={onInputBlur}
257+
onInputChange={onInputChange}
258+
onInputCommit={onInputCommit}
259+
onInputEscape={onInputEscape}
260+
onInputFocus={onInputFocus}
261+
onKeyDown={onKeyDown}
262+
onKeyDownCapture={onKeyDownCapture}
263+
onOpenChange={setIsOpen}
264+
onOptionSelected={onOptionSelected}
265+
onPaste={onPaste}
266+
data-test-id={
267+
state.collection.getLastKey() === item.key
268+
? 'arithmetic-builder-argument-input'
269+
: undefined
270+
}
271+
>
272+
{keyItem =>
273+
itemIsSection(keyItem) ? (
274+
<Section title={keyItem.label} key={keyItem.key}>
275+
{keyItem.options.map(child => (
276+
<Item {...child} key={child.key}>
277+
{child.label}
278+
</Item>
279+
))}
280+
</Section>
281+
) : (
282+
<Item {...keyItem} key={keyItem.key}>
283+
{keyItem.label}
284+
</Item>
285+
)
286+
}
287+
</ComboBox>
290288
);
291289
}
292290

static/app/components/core/alert/index.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Fragment, useRef, useState} from 'react';
1+
import {useRef, useState} from 'react';
22
import type {Theme} from '@emotion/react';
33
import {css} from '@emotion/react';
44
import styled from '@emotion/styled';
@@ -101,16 +101,14 @@ export function Alert({
101101
</ExpandIconWrap>
102102
)}
103103
{isExpanded && (
104-
<Fragment>
105-
<ExpandContainer
106-
ref={expandRef}
107-
showIcon={!!showIcon}
108-
showTrailingItems={!!trailingItems}
109-
{...expandHoverProps}
110-
>
111-
{Array.isArray(expand) ? expand.map(item => item) : expand}
112-
</ExpandContainer>
113-
</Fragment>
104+
<ExpandContainer
105+
ref={expandRef}
106+
showIcon={!!showIcon}
107+
showTrailingItems={!!trailingItems}
108+
{...expandHoverProps}
109+
>
110+
{Array.isArray(expand) ? expand.map(item => item) : expand}
111+
</ExpandContainer>
114112
)}
115113
</PanelProvider>
116114
</AlertContainer>
Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {Fragment} from 'react';
2-
31
import {
42
FeatureBadge,
53
type FeatureBadgeProps,
@@ -17,20 +15,18 @@ export default Storybook.story('FeatureBadge', story => {
1715
));
1816

1917
story('Variants', () => (
20-
<Fragment>
21-
<Storybook.PropMatrix<FeatureBadgeProps>
22-
render={props => (
23-
<span>
24-
Feature X
25-
<FeatureBadge {...props} />
26-
</span>
27-
)}
28-
propMatrix={{
29-
variant: ['badge', 'indicator', 'short'],
30-
type: ['alpha', 'beta', 'new', 'experimental'],
31-
}}
32-
selectedProps={['type', 'variant']}
33-
/>
34-
</Fragment>
18+
<Storybook.PropMatrix<FeatureBadgeProps>
19+
render={props => (
20+
<span>
21+
Feature X
22+
<FeatureBadge {...props} />
23+
</span>
24+
)}
25+
propMatrix={{
26+
variant: ['badge', 'indicator', 'short'],
27+
type: ['alpha', 'beta', 'new', 'experimental'],
28+
}}
29+
selectedProps={['type', 'variant']}
30+
/>
3531
));
3632
});

static/app/components/core/input/inputGroup.stories.tsx

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -90,40 +90,38 @@ export default Storybook.story('InputGroup', (story, APIReference) => {
9090

9191
story('Matrix', () => {
9292
return (
93-
<Fragment>
94-
<Storybook.PropMatrix
95-
render={({leadingItems, trailingItems}) => {
96-
return (
97-
<InputGroup>
98-
{leadingItems ? (
99-
<InputGroup.LeadingItems disablePointerEvents>
100-
{leadingItems}
101-
</InputGroup.LeadingItems>
102-
) : null}
103-
<InputGroup.Input placeholder="Search" />
104-
{trailingItems ? (
105-
<InputGroup.TrailingItems>{trailingItems}</InputGroup.TrailingItems>
106-
) : null}
107-
</InputGroup>
108-
);
109-
}}
110-
selectedProps={['leadingItems', 'trailingItems']}
111-
propMatrix={{
112-
leadingItems: [null, <IconSearch key="leading-icon" size="sm" />],
113-
trailingItems: [
114-
null,
115-
<IconAttachment key="trailing-icon" size="sm" />,
116-
<Button
117-
key="trailing-button"
118-
borderless
119-
icon={<IconSettings />}
120-
size="zero"
121-
aria-label="Toggle story representation"
122-
/>,
123-
],
124-
}}
125-
/>
126-
</Fragment>
93+
<Storybook.PropMatrix
94+
render={({leadingItems, trailingItems}) => {
95+
return (
96+
<InputGroup>
97+
{leadingItems ? (
98+
<InputGroup.LeadingItems disablePointerEvents>
99+
{leadingItems}
100+
</InputGroup.LeadingItems>
101+
) : null}
102+
<InputGroup.Input placeholder="Search" />
103+
{trailingItems ? (
104+
<InputGroup.TrailingItems>{trailingItems}</InputGroup.TrailingItems>
105+
) : null}
106+
</InputGroup>
107+
);
108+
}}
109+
selectedProps={['leadingItems', 'trailingItems']}
110+
propMatrix={{
111+
leadingItems: [null, <IconSearch key="leading-icon" size="sm" />],
112+
trailingItems: [
113+
null,
114+
<IconAttachment key="trailing-icon" size="sm" />,
115+
<Button
116+
key="trailing-button"
117+
borderless
118+
icon={<IconSettings />}
119+
size="zero"
120+
aria-label="Toggle story representation"
121+
/>,
122+
],
123+
}}
124+
/>
127125
);
128126
});
129127
});

0 commit comments

Comments
 (0)