-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Convert Overlay story to csf format (#7412)
## **Description** -Converted Overlay story to csf format ## **Screenshots/Recordings** ![Simulator Screen Shot - iPhone 14 Pro - 2023-10-07 at 16 51 09](https://github.com/MetaMask/metamask-mobile/assets/14355083/19d03094-40b5-46ee-9b33-08d91f3b3537) ![Simulator Screen Shot - iPhone 14 Pro - 2023-10-07 at 16 51 28](https://github.com/MetaMask/metamask-mobile/assets/14355083/dcfe89d4-64ef-4826-88c9-03e79fe185ad) ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've clearly explained: - [ ] What problem this PR is solving. - [ ] How this problem was solved. - [ ] How reviewers can test my changes. - [ ] I’ve indicated what issue this PR is linked to: Fixes #??? - [ ] I’ve included tests if applicable. - [ ] I’ve documented any added code. - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). - [ ] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
- Loading branch information
1 parent
3c395f6
commit 289d1fe
Showing
3 changed files
with
53 additions
and
49 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
43 changes: 19 additions & 24 deletions
43
app/component-library/components/Overlay/Overlay.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 |
---|---|---|
@@ -1,33 +1,28 @@ | ||
/* eslint-disable no-console, react-native/no-inline-styles */ | ||
|
||
/* eslint-disable react/display-name */ | ||
/* eslint-disable no-console */ | ||
// Third party dependencies. | ||
import React from 'react'; | ||
import { color } from '@storybook/addon-knobs'; | ||
import { storiesOf } from '@storybook/react-native'; | ||
|
||
// External dependencies. | ||
import { mockTheme } from '../../../util/theme'; | ||
import { storybookPropsGroupID } from '../../constants/storybook.constants'; | ||
|
||
// Internal dependencies. | ||
import Overlay from './Overlay'; | ||
import { OverlayProps } from './Overlay.types'; | ||
|
||
export const getOverlayStoryProps = (): OverlayProps => { | ||
const colorSelector = color( | ||
'color', | ||
mockTheme.colors.overlay.default, | ||
storybookPropsGroupID, | ||
); | ||
|
||
return { | ||
color: colorSelector, | ||
onPress: () => console.log("I'm clicked!"), | ||
}; | ||
import { default as OverlayComponent } from './Overlay'; | ||
|
||
const OverlayMeta = { | ||
title: 'Component Library / Overlay', | ||
component: OverlayComponent, | ||
argTypes: { | ||
color: { | ||
control: { type: 'color' }, | ||
defaultValue: mockTheme.colors.overlay.default, | ||
}, | ||
}, | ||
}; | ||
export default OverlayMeta; | ||
|
||
const OverlayStory = () => <Overlay {...getOverlayStoryProps()} />; | ||
|
||
storiesOf('Component Library / Overlay', module).add('Overlay', OverlayStory); | ||
|
||
export default OverlayStory; | ||
export const Overlay = { | ||
render: (args: any) => ( | ||
<OverlayComponent {...args} onPress={() => console.log("I'm clicked!")} /> | ||
), | ||
}; |