Skip to content

Commit f79ea25

Browse files
committed
feat: use SimplePage instead of ScreenshotArea
1 parent 6435be5 commit f79ea25

File tree

3 files changed

+32
-40
lines changed

3 files changed

+32
-40
lines changed

pages/multiselect/custom-render-option.page.tsx

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
import * as React from 'react';
44

55
import { Multiselect, MultiselectProps } from '~components';
6-
import Box from '~components/box';
76
import { SelectProps } from '~components/select';
87

9-
import ScreenshotArea from '../utils/screenshot-area';
8+
import { SimplePage } from '../app/templates';
109
import { i18nStrings } from './constants';
1110
const lotsOfOptions: SelectProps.Options = [...Array(50)].map((_, index) => ({
1211
value: `Option ${index}`,
@@ -48,24 +47,21 @@ export default function SelectPage() {
4847
};
4948

5049
return (
51-
<ScreenshotArea>
52-
<Box variant="h1">Multiselect with custom item renderer</Box>
53-
<Box padding="l">
54-
<div style={{ width: '400px' }}>
55-
<Multiselect
56-
enableSelectAll={true}
57-
i18nStrings={{ ...i18nStrings, selectAllText: 'Select all' }}
58-
filteringType={'auto'}
59-
renderOption={renderOptionItem}
60-
placeholder="Choose option"
61-
selectedOptions={selectedOptions}
62-
onChange={event => {
63-
setSelectedOptions(event.detail.selectedOptions);
64-
}}
65-
options={options}
66-
/>
67-
</div>
68-
</Box>
69-
</ScreenshotArea>
50+
<SimplePage title="Multiselect with custom item renderer" screenshotArea={{}}>
51+
<div style={{ width: '400px' }}>
52+
<Multiselect
53+
enableSelectAll={true}
54+
i18nStrings={{ ...i18nStrings, selectAllText: 'Select all' }}
55+
filteringType={'auto'}
56+
renderOption={renderOptionItem}
57+
placeholder="Choose option"
58+
selectedOptions={selectedOptions}
59+
onChange={event => {
60+
setSelectedOptions(event.detail.selectedOptions);
61+
}}
62+
options={options}
63+
/>
64+
</div>
65+
</SimplePage>
7066
);
7167
}

pages/select/custom-render-option.page.tsx

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
import * as React from 'react';
44
import { useState } from 'react';
55

6-
import Box from '~components/box';
76
import Select, { SelectProps } from '~components/select';
87

9-
import ScreenshotArea from '../utils/screenshot-area';
8+
import { SimplePage } from '../app/templates';
109

1110
const lotsOfOptions = [...Array(50).keys()].map(n => {
1211
const numberToDisplay = (n + 5).toString();
@@ -51,21 +50,18 @@ export default function SelectPage() {
5150
};
5251

5352
return (
54-
<ScreenshotArea>
55-
<Box variant="h1">Select with custom item renderer</Box>
56-
<Box padding="l">
57-
<div style={{ width: '400px' }}>
58-
<Select
59-
filteringType="auto"
60-
renderOption={renderOption}
61-
placeholder="Choose option"
62-
selectedOption={selectedOption}
63-
onChange={({ detail }) => setSelectedOption(detail.selectedOption)}
64-
options={options}
65-
triggerVariant="option"
66-
/>
67-
</div>
68-
</Box>
69-
</ScreenshotArea>
53+
<SimplePage title="Select with custom item renderer" screenshotArea={{}}>
54+
<div style={{ width: '400px' }}>
55+
<Select
56+
filteringType="auto"
57+
renderOption={renderOption}
58+
placeholder="Choose option"
59+
selectedOption={selectedOption}
60+
onChange={({ detail }) => setSelectedOption(detail.selectedOption)}
61+
options={options}
62+
triggerVariant="option"
63+
/>
64+
</div>
65+
</SimplePage>
7066
);
7167
}

src/select/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export interface SelectProps extends BaseSelectProps {
191191
*/
192192
autoFocus?: boolean;
193193
/**
194-
* Specifies a render function to render custom options in the dropdown menu.
194+
* Specifies a render function to render custom options in the dropdown menu or trigger.
195195
*
196196
* @awsuiSystem core
197197
*/

0 commit comments

Comments
 (0)