-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Popup): add
eventsEnabled
prop (#3715)
* feat(Popup): add `eventsEnabled` prop * fix UT * fix styles on Knobs
- Loading branch information
1 parent
048bd35
commit c86e198
Showing
10 changed files
with
184 additions
and
46 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
43 changes: 43 additions & 0 deletions
43
docs/src/components/ComponentDoc/ComponentExample/ComponentExampleKnobs.js
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,43 @@ | ||
import { CodeSnippet, KnobInspector, useKnobValues } from '@stardust-ui/docs-components' | ||
import _ from 'lodash' | ||
import React from 'react' | ||
import { Grid } from 'semantic-ui-react' | ||
|
||
const columnStyles = { | ||
padding: 0, | ||
} | ||
|
||
const knobsStyles = { | ||
background: 'whitesmoke', | ||
color: '#777', | ||
lineHeight: '1.5', | ||
padding: '1rem', | ||
} | ||
|
||
const rowStyles = { | ||
padding: 0, | ||
} | ||
|
||
const ComponentExampleKnobs = () => { | ||
const knobValues = useKnobValues() | ||
const values = _.fromPairs(knobValues.map((knob) => [knob.name, knob.value])) | ||
|
||
return ( | ||
<KnobInspector> | ||
{(knobs) => | ||
knobs && ( | ||
<Grid.Row columns={2} stretched style={rowStyles}> | ||
<Grid.Column style={columnStyles}> | ||
<div style={knobsStyles}> {knobs}</div> | ||
</Grid.Column> | ||
<Grid.Column style={columnStyles}> | ||
<CodeSnippet copyable={false} fitted label='Knobs' mode='json' value={values} /> | ||
</Grid.Column> | ||
</Grid.Row> | ||
) | ||
} | ||
</KnobInspector> | ||
) | ||
} | ||
|
||
export default ComponentExampleKnobs |
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
25 changes: 25 additions & 0 deletions
25
docs/src/examples/modules/Popup/Usage/PopupExampleEventsEnabled.js
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,25 @@ | ||
import { useBooleanKnob } from '@stardust-ui/docs-components' | ||
import React from 'react' | ||
import { Button, Popup } from 'semantic-ui-react' | ||
|
||
const PopupExampleEventsEnabled = () => { | ||
const [eventsEnabled] = useBooleanKnob({ | ||
name: 'eventsEnabled', | ||
initialValue: true, | ||
}) | ||
const [open, setOpen] = useBooleanKnob({ name: 'open' }) | ||
|
||
return ( | ||
<Popup | ||
content='Hello' | ||
eventsEnabled={eventsEnabled} | ||
on='click' | ||
onClose={() => setOpen(false)} | ||
onOpen={() => setOpen(true)} | ||
open={open} | ||
trigger={<Button content='A trigger' />} | ||
/> | ||
) | ||
} | ||
|
||
export default PopupExampleEventsEnabled |
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