Skip to content

Commit 3b8409a

Browse files
committed
update contents
1 parent 3e653eb commit 3b8409a

File tree

4 files changed

+206
-148
lines changed

4 files changed

+206
-148
lines changed
File renamed without changes.

docs/data/joy/components/autocomplete/CustomTags.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22
import Autocomplete from '@mui/joy/Autocomplete';
33
import Input from '@mui/joy/Input';
44
import Chip from '@mui/joy/Chip';
5+
import Close from '@mui/icons-material/Close';
56

67
export default function CustomTags() {
78
return (
@@ -16,7 +17,12 @@ export default function CustomTags() {
1617
)}
1718
renderTags={(tags, getTagProps) =>
1819
tags.map((item, index) => (
19-
<Chip variant="solid" color="primary" {...getTagProps({ index })}>
20+
<Chip
21+
variant="solid"
22+
color="primary"
23+
endDecorator={<Close fontSize="sm" />}
24+
{...getTagProps({ index })}
25+
>
2026
{item.title}
2127
</Chip>
2228
))

docs/data/joy/components/autocomplete/Playground.js

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22
import Autocomplete from '@mui/joy/Autocomplete';
33
import Box from '@mui/joy/Box';
44
import Checkbox from '@mui/joy/Checkbox';
5+
import Divider from '@mui/joy/Divider';
56
import Link from '@mui/joy/Link';
67
import FormControl, { formControlClasses } from '@mui/joy/FormControl';
78
import FormLabel from '@mui/joy/FormLabel';
@@ -27,20 +28,26 @@ export default function Playground() {
2728
<Box>
2829
<Box
2930
sx={{
30-
p: 2,
31-
borderRadius: 'xs',
32-
bgcolor: 'background.level1',
31+
pt: 2,
32+
pb: 1,
33+
bgcolor: 'background.surface',
34+
position: 'sticky',
35+
top: 'var(--MuiDocs-header-height)',
36+
zIndex: 2,
3337
}}
3438
>
35-
<Autocomplete
36-
options={top100Films}
37-
renderInput={(params) => <Input {...params} placeholder="Playground" />}
38-
{...flags.reduce((prev, current) => ({ ...prev, [current]: true }), {})}
39-
sx={{ width: 300, mx: 'auto' }}
40-
/>
41-
</Box>
42-
<Box sx={{ minWidth: 0, flexBasis: 300, flexGrow: 1, mt: 2 }}>
43-
<Box sx={{ display: 'flex', alignItems: 'baseline', pb: 1 }}>
39+
<FormControl sx={{ width: 300, mx: 'auto' }}>
40+
<FormLabel>Playground</FormLabel>
41+
<Autocomplete
42+
options={top100Films}
43+
renderInput={(params) => (
44+
<Input {...params} placeholder="Type to search" />
45+
)}
46+
{...flags.reduce((prev, current) => ({ ...prev, [current]: true }), {})}
47+
/>
48+
</FormControl>
49+
<Divider sx={{ mt: 3, mb: 2 }} />
50+
<Box sx={{ display: 'flex', alignItems: 'baseline' }}>
4451
<Typography
4552
id="flags-playground"
4653
level="body3"
@@ -52,22 +59,25 @@ export default function Playground() {
5259
>
5360
Flags {flags.length ? `(${flags.length})` : ''}
5461
</Typography>
55-
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
56-
<Link
57-
component="button"
58-
level="body2"
59-
onClick={() => setFlags([])}
60-
sx={{ ml: 'auto' }}
61-
>
62-
Clear all
63-
</Link>
62+
{flags.length > 0 && (
63+
// eslint-disable-next-line jsx-a11y/anchor-is-valid
64+
<Link
65+
component="button"
66+
level="body2"
67+
onClick={() => setFlags([])}
68+
sx={{ ml: 'auto' }}
69+
>
70+
Clear all
71+
</Link>
72+
)}
6473
</Box>
74+
</Box>
75+
<Box sx={{ minWidth: 0, flexBasis: 300, flexGrow: 1 }}>
6576
<List
6677
aria-labelledby="flags-playground"
6778
sx={{
6879
display: 'grid',
6980
gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))',
70-
maxHeight: 360,
7181
overflow: 'auto',
7282
px: 0.5,
7383
'--List-gap': '8px',

0 commit comments

Comments
 (0)