This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Popup): make 'content' prop to be a shorthand (#322)
* introduce Popup content prop as a shorthand * fix popup content shorthand factory for primitives * introduce popup content example * fix popup examples * update changelog * simplify popup content wrapper examples * fix create factory of PopupContent
- Loading branch information
Showing
10 changed files
with
154 additions
and
26 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
46 changes: 46 additions & 0 deletions
46
docs/src/examples/components/Popup/Types/PopupContentWrapperExample.shorthand.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,46 @@ | ||
import React from 'react' | ||
import { Button, Popup } from '@stardust-ui/react' | ||
|
||
class PopupContentWrapperExample extends React.Component<any, any> { | ||
state = { | ||
firstPopupOpen: false, | ||
secondPopupOpen: false, | ||
} | ||
|
||
render() { | ||
const plainContentStyle = { | ||
zIndex: 1000, | ||
padding: 5, | ||
} | ||
|
||
return ( | ||
<> | ||
<Popup | ||
open={this.state.firstPopupOpen} | ||
content={<p style={plainContentStyle}>Plain popup content rendered 'as is'.</p>} | ||
trigger={ | ||
<Button | ||
icon="expand" | ||
onClick={() => this.setState(prev => ({ firstPopupOpen: !prev.firstPopupOpen }))} | ||
content="Popup with plain content" | ||
/> | ||
} | ||
/> | ||
|
||
<Popup | ||
open={this.state.secondPopupOpen} | ||
content={{ content: <p style={plainContentStyle}>Popup content rendered in wrapper.</p> }} | ||
trigger={ | ||
<Button | ||
icon="expand" | ||
onClick={() => this.setState(prev => ({ secondPopupOpen: !prev.secondPopupOpen }))} | ||
content="Popup with wrapped content" | ||
/> | ||
} | ||
/> | ||
</> | ||
) | ||
} | ||
} | ||
|
||
export default PopupContentWrapperExample |
44 changes: 44 additions & 0 deletions
44
docs/src/examples/components/Popup/Types/PopupContentWrapperExample.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,44 @@ | ||
import React from 'react' | ||
import { Button, Popup } from '@stardust-ui/react' | ||
|
||
class PopupContentWrapperExample extends React.Component<any, any> { | ||
state = { | ||
firstPopupOpen: false, | ||
secondPopupOpen: false, | ||
} | ||
|
||
render() { | ||
const plainContentStyle = { | ||
zIndex: 1000, | ||
padding: 5, | ||
} | ||
|
||
return ( | ||
<> | ||
<Popup | ||
open={this.state.firstPopupOpen} | ||
content={<p style={plainContentStyle}>Plain popup content rendered 'as is'.</p>} | ||
> | ||
<Button | ||
icon="expand" | ||
onClick={() => this.setState(prev => ({ firstPopupOpen: !prev.firstPopupOpen }))} | ||
content="Popup with plain content" | ||
/> | ||
</Popup> | ||
|
||
<Popup | ||
open={this.state.secondPopupOpen} | ||
content={{ content: <p style={plainContentStyle}>Popup content rendered in wrapper.</p> }} | ||
> | ||
<Button | ||
icon="expand" | ||
onClick={() => this.setState(prev => ({ secondPopupOpen: !prev.secondPopupOpen }))} | ||
content="Popup with wrapped content" | ||
/> | ||
</Popup> | ||
</> | ||
) | ||
} | ||
} | ||
|
||
export default PopupContentWrapperExample |
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
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