-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Sheet): resize sheet if image in content is loaded (#1566)
- Loading branch information
1 parent
b8b9e7a
commit 8b56abd
Showing
5 changed files
with
99 additions
and
17 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
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
15 changes: 15 additions & 0 deletions
15
src/components/Sheet/__stories__/MultipleSheetsShowcase/MultipleSheets.scss
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.sheet-stories-with-multiple-sheets { | ||
display: flex; | ||
justify-content: center; | ||
|
||
&__show-btn { | ||
margin: 20px 0; | ||
} | ||
|
||
img { | ||
object-fit: contain; | ||
border: none; | ||
max-width: 100%; | ||
vertical-align: middle; | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/components/Sheet/__stories__/MultipleSheetsShowcase/MultipleSheets.stories.tsx
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React from 'react'; | ||
|
||
import type {Meta, StoryFn} from '@storybook/react'; | ||
|
||
import {Button} from '../../..'; | ||
import {cn} from '../../../utils/cn'; | ||
import {Sheet} from '../../Sheet'; | ||
import type {SheetProps} from '../../Sheet'; | ||
|
||
import './MultipleSheets.scss'; | ||
|
||
const b = cn('sheet-stories-with-multiple-sheets'); | ||
|
||
export default { | ||
title: 'Components/Overlays/Sheet', | ||
component: Sheet, | ||
} as Meta; | ||
|
||
export const MultipleSheets: StoryFn<SheetProps> = (args: SheetProps) => { | ||
const [visible, setVisible] = React.useState(false); | ||
const [moreContentVisible, setMoreContentVisible] = React.useState(false); | ||
|
||
return ( | ||
<div className={b()}> | ||
<Button className={b('show-btn')} onClick={() => setVisible(true)}> | ||
Show modal | ||
</Button> | ||
<Sheet {...args} visible={visible} id="main" onClose={() => setVisible(false)}> | ||
<img | ||
src="https://avatars.githubusercontent.com/u/107542106" | ||
width="100%" | ||
alt="example" | ||
/> | ||
<Button | ||
size="xl" | ||
width="max" | ||
className={b('show-btn')} | ||
onClick={() => setMoreContentVisible(true)} | ||
> | ||
Show one more modal | ||
</Button> | ||
</Sheet> | ||
<Sheet | ||
{...args} | ||
id="more-content" | ||
visible={moreContentVisible} | ||
onClose={() => setMoreContentVisible(false)} | ||
> | ||
<div className={b('text')}> | ||
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Aliquam consequatur | ||
quasi quo temporibus. Optio tenetur, aliquam ratione natus asperiores | ||
necessitatibus? Cumque nulla nesciunt esse minus cum nam rerum illum dicta. | ||
</div> | ||
<div> | ||
<Button | ||
size="xl" | ||
width="max" | ||
className={b('show-btn')} | ||
onClick={() => setMoreContentVisible(false)} | ||
> | ||
Close | ||
</Button> | ||
</div> | ||
</Sheet> | ||
</div> | ||
); | ||
}; |
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