-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[joy-ui][Button] Fix button size being a decorator (#39529)
- Loading branch information
1 parent
baf6bc7
commit 1fd4dff
Showing
8 changed files
with
95 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,50 @@ | ||
import * as React from 'react'; | ||
import Button from '@mui/joy/Button'; | ||
import Divider from '@mui/joy/Divider'; | ||
import Input from '@mui/joy/Input'; | ||
import Select from '@mui/joy/Select'; | ||
import Option from '@mui/joy/Option'; | ||
import Stack from '@mui/joy/Stack'; | ||
import LocationOn from '@mui/icons-material/LocationOn'; | ||
|
||
export default function InputDecorators() { | ||
const [currency, setCurrency] = React.useState('dollar'); | ||
return ( | ||
<Input | ||
placeholder="Amount" | ||
startDecorator={{ dollar: '$', baht: '฿', yen: '¥' }[currency]} | ||
endDecorator={ | ||
<React.Fragment> | ||
<Divider orientation="vertical" /> | ||
<Select | ||
variant="plain" | ||
value={currency} | ||
onChange={(_, value) => setCurrency(value)} | ||
slotProps={{ | ||
listbox: { | ||
variant: 'outlined', | ||
}, | ||
}} | ||
sx={{ mr: -1.5, '&:hover': { bgcolor: 'transparent' } }} | ||
> | ||
<Option value="dollar">US dollar</Option> | ||
<Option value="baht">Thai baht</Option> | ||
<Option value="yen">Japanese yen</Option> | ||
</Select> | ||
</React.Fragment> | ||
} | ||
sx={{ width: 300 }} | ||
/> | ||
<Stack spacing={1.5}> | ||
<Input | ||
placeholder="Amount" | ||
startDecorator={{ dollar: '$', baht: '฿', yen: '¥' }[currency]} | ||
endDecorator={ | ||
<React.Fragment> | ||
<Divider orientation="vertical" /> | ||
<Select | ||
variant="plain" | ||
value={currency} | ||
onChange={(_, value) => setCurrency(value)} | ||
slotProps={{ | ||
listbox: { | ||
variant: 'outlined', | ||
}, | ||
}} | ||
sx={{ mr: -1.5, '&:hover': { bgcolor: 'transparent' } }} | ||
> | ||
<Option value="dollar">US dollar</Option> | ||
<Option value="baht">Thai baht</Option> | ||
<Option value="yen">Japanese yen</Option> | ||
</Select> | ||
</React.Fragment> | ||
} | ||
sx={{ width: 300 }} | ||
/> | ||
<Input | ||
placeholder="Your location" | ||
startDecorator={ | ||
<Button variant="soft" color="neutral" startDecorator={<LocationOn />}> | ||
Locate | ||
</Button> | ||
} | ||
sx={{ width: 300 }} | ||
/> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,50 @@ | ||
import * as React from 'react'; | ||
import Button from '@mui/joy/Button'; | ||
import Divider from '@mui/joy/Divider'; | ||
import Input from '@mui/joy/Input'; | ||
import Select from '@mui/joy/Select'; | ||
import Option from '@mui/joy/Option'; | ||
import Stack from '@mui/joy/Stack'; | ||
import LocationOn from '@mui/icons-material/LocationOn'; | ||
|
||
export default function InputDecorators() { | ||
const [currency, setCurrency] = React.useState('dollar'); | ||
return ( | ||
<Input | ||
placeholder="Amount" | ||
startDecorator={{ dollar: '$', baht: '฿', yen: '¥' }[currency]} | ||
endDecorator={ | ||
<React.Fragment> | ||
<Divider orientation="vertical" /> | ||
<Select | ||
variant="plain" | ||
value={currency} | ||
onChange={(_, value) => setCurrency(value!)} | ||
slotProps={{ | ||
listbox: { | ||
variant: 'outlined', | ||
}, | ||
}} | ||
sx={{ mr: -1.5, '&:hover': { bgcolor: 'transparent' } }} | ||
> | ||
<Option value="dollar">US dollar</Option> | ||
<Option value="baht">Thai baht</Option> | ||
<Option value="yen">Japanese yen</Option> | ||
</Select> | ||
</React.Fragment> | ||
} | ||
sx={{ width: 300 }} | ||
/> | ||
<Stack spacing={1.5}> | ||
<Input | ||
placeholder="Amount" | ||
startDecorator={{ dollar: '$', baht: '฿', yen: '¥' }[currency]} | ||
endDecorator={ | ||
<React.Fragment> | ||
<Divider orientation="vertical" /> | ||
<Select | ||
variant="plain" | ||
value={currency} | ||
onChange={(_, value) => setCurrency(value!)} | ||
slotProps={{ | ||
listbox: { | ||
variant: 'outlined', | ||
}, | ||
}} | ||
sx={{ mr: -1.5, '&:hover': { bgcolor: 'transparent' } }} | ||
> | ||
<Option value="dollar">US dollar</Option> | ||
<Option value="baht">Thai baht</Option> | ||
<Option value="yen">Japanese yen</Option> | ||
</Select> | ||
</React.Fragment> | ||
} | ||
sx={{ width: 300 }} | ||
/> | ||
<Input | ||
placeholder="Your location" | ||
startDecorator={ | ||
<Button variant="soft" color="neutral" startDecorator={<LocationOn />}> | ||
Locate | ||
</Button> | ||
} | ||
sx={{ width: 300 }} | ||
/> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters