-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EditLayoutButton: replaced to ui folder, added props description and …
…stories
- Loading branch information
1 parent
0b3c501
commit f0ca80a
Showing
4 changed files
with
62 additions
and
11 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
File renamed without changes.
42 changes: 42 additions & 0 deletions
42
packages/core/src/components/ui/EditLayoutButton/stories/EditLayoutButton.stories.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,42 @@ | ||
import React, { useCallback, useState } from 'react' | ||
|
||
import { | ||
showTemplateStory, | ||
getDefaultMetadata, | ||
} from '../../../../../../storybook/.storybook/helper' | ||
import Modal from '../../Dialog' | ||
import Button, { EditLayoutButton } from '../EditLayoutButton' | ||
|
||
export default getDefaultMetadata( | ||
EditLayoutButton, | ||
'Components/ui/EditLayoutButton', | ||
) | ||
|
||
const Component = () => { | ||
const [isShowingModal, setModalShowing] = useState(false) | ||
|
||
const onClose = useCallback(() => setModalShowing(false), []) | ||
|
||
return ( | ||
<> | ||
<Button | ||
layoutIsEditable={isShowingModal} | ||
enableEditLayout={() => setModalShowing(true)} | ||
closeEditLayout={onClose} | ||
/> | ||
<Modal | ||
title='Edit Layout Modal' | ||
isOpen={isShowingModal} | ||
onClose={onClose} | ||
> | ||
Here you can edit layout | ||
<Modal.Footer> | ||
<Modal.Button primary onClick={onClose}> | ||
OK | ||
</Modal.Button> | ||
</Modal.Footer> | ||
</Modal> | ||
</> | ||
) | ||
} | ||
export const basic = showTemplateStory(Component, {}) |